Chronos wrote:
I am trying to access the contact list and display it in a CUSTOM
> ListView (ListActivity is not an option). Unfortunately the activity
> fails with a NullPointerException :( This may be a simple issue - have
> I overlooked something ? Help appreciated ... (I have tried the code
> with a ListActivity and got valid results - therefore I assume, the
> Cursor instantiation is correct)
<snip>
> @Override
> public void onCreate(Bundle savedInstanceState)
> {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.mainmenu);
Here you load res/layout/mainmenu.xml.
> recommendationList = (ListView) findViewById
> (R.id.recommendationList);
Here you try to find recommendationList in res/layout/mainmenu.xml.
> Recommendation.xml:
Here you say the layout you're aiming for is res/layout/Recommendation.xml.
> <ListView xmlns:android="http://schemas.android.com/apk/res/android"
> android:id="@+id/recommendationList"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"/>
> </LinearLayout>
Here is a recommendationList in res/layout/Recommendation.xml.
If all those are correct, then you may be loading the wrong layout,
which would make your recommendationList variable null after the
findViewById() call.
Also, I recommend all resources (layouts, etc.) be named in all
lowercase, since on some platforms you can have a Recommendation.xml and
a recommendation.xml, but Android ignores case in the R.java generation,
which may cause confusion.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---