Skip to content Skip to sidebar Skip to footer

Unable To Substantiate Activity Componentinfo - Null Pointer Exception

I have spent the day trying to fathom this one out (needless to say I am a long way down the learnign curve - hence my need to ask for help!) - below is a simple database program (

Solution 1:

You can not do like that as static initializer in your activity:

ListViewlistContent= (ListView)findViewById(R.id.contentlist);

The reason is that you have nto yet loaded the layout for your activity and thus this call will fail findViewById(R.id.contentlist). Your error comes from the class static initializers, since you do not declare constructor of your class, still get error in the <init>.

Fix: Initialize the list view in the onCreate, after you call setContentView(R.layout.show);.

Solution 2:

Your ShowActivity activity has a layout containing a ListView with an id @android:id/list but you search for the listView with the id R.id.contentlist. Also you must initialize your views in the onCreate() method after you set the layout.

Post a Comment for "Unable To Substantiate Activity Componentinfo - Null Pointer Exception"