Search Results

Search found 1 results on 1 pages for 'lethjakman'.

Page 1/1 | 1 

  • Android ListView appears empty, but contains objects

    - by Lethjakman
    I'm having a really odd problem with my android listview. The listview is inside of a fragment, everything's compiling and I'm no longer getting a nullpointer error, but the listview is appearing empty. Even though it's appearing empty, the log is stating that the listview has 385 objects. I can't figure out why it's empty. I do get a blue fragment, and the listview is populated. Any ideas? How I set the adapter: ActivePackages = getList(); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout mContainer = (LinearLayout) inflater.inflate(R.layout.tab_frag1_layout, null); ListView activeList = (ListView) mContainer.findViewById(R.id.activelist); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, ActivePackages); Log.i("valueof activeList",String.valueOf(activeList.getCount())); //returns 0 activeList.setAdapter(adapter); adapter.notifyDataSetChanged(); Log.i("valueof activeList",String.valueOf(activeList.getCount())); //returns 385. This is the xml for the fragment: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/activelist" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0073fd"> </ListView> </LinearLayout>

    Read the article

1