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 8548505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:30:44+00:00 2026-06-11T13:30:44+00:00

i cant display listview from 2 days, read all threads in android.develop, here and

  • 0

i cant display listview from 2 days, read all threads in android.develop, here and in google but i cant figure out what is crashing my app. If i remove last line from ListShow() the app will not crash but if i list.setAdapter(push); the app dont start at all.

MainActivity.java

public class MainActivity extends Activity {

//Main function
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Call all function to create
    TextCount();
    ListShow();
}

//Menu function
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

//Text counter function
public void TextCount() {
    int c=0;
    TextView t = new TextView(this); 
    t=(TextView)findViewById(R.id.file_counter); 
    t.setText((c)+" files loaded");
}

//List Function
public void ListShow() {
    String[] items= new String[] {"item 1", "item 2", "item 3", "item 4", "item 5",     "item 5"};

    ArrayAdapter<String> push = new ArrayAdapter<String>(this, R.layout.item, items);
    ListView list = (ListView) findViewById(R.id.list_view);
    list.setAdapter(push);
}
}

main_activity.xml

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

<include layout="@layout/header" />

<View android:id="@+id/separator_up"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/blue_light"/>

<TextView
    android:id="@+id/file_counter"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:text="@string/file_counter" />

<ListView
    android:id="@+id/list_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >
</ListView>

<View android:id="@+id/separator_down"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@color/blue_light"/>

<include layout="@layout/footer" />

</LinearLayout>

item.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/simple"
android:text="" >
</TextView>
  • 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-11T13:30:46+00:00Added an answer on June 11, 2026 at 1:30 pm

    I think your ListView row layout should be like this:

    <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/simple"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    

    it will not work without the layout attributes.

    Also, you should always post the stacktrace with the exception from the logcat.

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

Sidebar

Related Questions

I'd like to display records from our database in a listview - but retrieves
I can't figure out why this UIView doesn't display correctly when the method is
I writing a C++ simple application, to figure out why i can't display any
I can't figure out why jquerymobile does not correctly display in xCode4's i0s simulator
i'm trying to display my portfolio items in a gird, but can't quite figure
So I have been trying to get a ListView to display data from a
Im trying to debug my menu activity but it cant seem to display the
Ive been learning about the getview . But i cant get it to display
I have a query in my android app that pulls all image paths from
I have a listView of contacts that I got from the Android ContactManager sample.

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.