Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:27:18+00:00 2026-06-15T05:27:18+00:00

I know, that here are lots of question about this topic and google have

  • 0

I know, that here are lots of question about this topic and google have many tutorials about it, but I still have a problem, so please tell my where I’m wrong ;/. There are my classes:

layout class (activity_finish.xml):

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#b5b5b5"
        android:dividerHeight="3dp"
        android:listSelector="@drawable/list_selector" />

</LinearLayout>

row layout (list_row.xml):

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_selector"
    android:orientation="horizontal"
    android:padding="5dip" >

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:padding="3dip" >

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:contentDescription="@string/desc"
            android:src="@drawable/icon" />
    </LinearLayout>

    <TextView
        android:id="@+id/time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dip"
        android:layout_alignBottom="@+id/destinationName"
        android:gravity="right"
        android:text="@string/time"
        android:textColor="#10bcc9"
        android:textSize="23dip" />

    <TextView
        android:id="@+id/destination"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginTop="8dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="@string/destination"
        android:textColor="#343434"
        android:textSize="13dip" />

    <TextView
        android:id="@+id/destinationName"
        android:layout_width="153dip"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/destination"
        android:layout_below="@+id/destination"
        android:text="@string/destinationName"
        android:textColor="#040404"
        android:textSize="20dip"
        android:textStyle="bold"
        android:typeface="sans" />

    <TextView
        android:id="@+id/stopName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/thumbnail"
        android:layout_below="@+id/thumbnail"
        android:text="@string/stopName"
        android:layout_marginLeft="3dip" />

    <TextView
        android:id="@+id/stopStreet"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/thumbnail"
        android:layout_below="@+id/stopName"
        android:layout_marginTop="3dip"
        android:text="@string/stopStreet" 
        android:layout_marginLeft="3dip"/>

    <TextView
        android:id="@+id/stopOneWay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/time"
        android:layout_below="@+id/stopName"
        android:layout_marginTop="3dip"
        android:text="@string/stopOneWay" 
        android:layout_marginLeft="3dip"/>

    <TextView
        android:id="@+id/lineNumber"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_alignLeft="@+id/thumbnail"
        android:layout_alignTop="@+id/thumbnail"
        android:gravity="center"
        android:text="@string/lineNumber" 
        android:layout_marginLeft="3dip"
        android:textStyle="bold"
        android:textSize="28dip"
        android:textColor="#DCF0F5"/>

</RelativeLayout>

StopAdapter:

public class StopAdapter extends ArrayAdapter<DisplayStop> {

    private List<DisplayStop> stops;
    private LayoutInflater inflater;
    private Context context;

    int layoutResourceId;

    public StopAdapter(Context context, int layoutResourceId, List<DisplayStop> stops) {

        super(context, layoutResourceId, stops);

        this.context = context;
        this.layoutResourceId = layoutResourceId;
        this.stops = stops;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){

        View row = convertView;

        ViewHolder holder = new ViewHolder();

        if(row == null)
        {
            inflater = ((Activity)context).getLayoutInflater();

            row = inflater.inflate(layoutResourceId, parent, false);

            holder.image = (ImageView) row.findViewById(R.id.list_image);
            holder.time = (TextView) row.findViewById(R.id.time);
            holder.destination = (TextView) row.findViewById(R.id.destination);
            holder.destination = (TextView) row.findViewById(R.id.destinationName);
            holder.stopName = (TextView) row.findViewById(R.id.stopName);
            holder.stopStreet = (TextView) row.findViewById(R.id.stopStreet);
            holder.stopOneWay = (TextView) row.findViewById(R.id.stopOneWay);
            holder.lineNumber = (TextView) row.findViewById(R.id.lineNumber);

            row.setTag(holder);

        }

        else{
            holder = (ViewHolder)row.getTag();
        }

        holder.time.setText(stops.get(position).getTime());
        holder.destination.setText("Kierunek:");
        holder.destinationName.setText(stops.get(position).getDestination());
        holder.stopName.setText(stops.get(position).getName());
        holder.stopStreet.setText(stops.get(position).getAddress());
        holder.lineNumber.setText(stops.get(position).getLine());

        if(stops.get(position).getOneWay()) holder.stopOneWay.setText("P. jednokierunkowy");
        else holder.stopOneWay.setText("");

        int line = Integer.parseInt(stops.get(position).getLine());

        if(line >= 50){
            holder.image.setImageResource(R.drawable.icon);
        }
        else{
            holder.image.setImageResource(R.drawable.icon2);
        }

        return row;
    }
}

FinishActivity:

public class FinishActivity extends Activity {

    private ListView lv;
    private List<DisplayStop> stops;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_finish);

        lv = (ListView) findViewById(R.id.list);

        stops = getStops();//create several objects in list

        if(stops.size() > 0){
            StopAdapter stopAdapter = new StopAdapter(this, R.layout.list_row, stops);
            lv.setAdapter(stopAdapter);     
        }
        else
        {
            Log.d("klop", "0 elementów");
        }


    }

Please help, bacause I have no idea what can be wrong (I made several versions from severals tutorials and still nothing ;/)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:27:19+00:00Added an answer on June 15, 2026 at 5:27 am

    Ok, I found the problem – it was really STUPID – in StopAdapter I made Mistake in lines:

    holder.destination = (TextView) row.findViewById(R.id.destination);
    holder.destination = (TextView) row.findViewById(R.id.destinationName);
    

    so text in destination was null. It should be:

    holder.destination = (TextView) row.findViewById(R.id.destination)
    holder.destinationName = (TextView) row.findViewById(R.id.destinationName);
    

    And everything is good. Thanks for help – I know the simplest errors are the hardest to find 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this sort of question has been asked here before, but still
I know that many threads has been created here & on the internet about
I know that this has already been asked here but the answer (using a
I know that this question is very similar to the question posted here .
I know that you can't have a constructor in an interface, but here is
this is my first question here :) I know that I should not check
I know there is a lot of resources about that here but yet, I
I know that can co-exists with web form no problem as Hanselman mention here
G'day, While having a think about this question here about overdesigning for possible future
(This question is not about programming, but about how to avoid doing any programming.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.