ListActivity NullPointerException ??

Put your problem here if it does not fit any of the other categories.

ListActivity NullPointerException ??

Postby ramgraph1 » Fri Feb 22, 2008 1:14 am

I have a ListActivity which has given me a NullPointerException. I have cut it down and down again until there is almost nothing left of the code and I am still getting the exception!
Here is the code:
from the ListActivity:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class Scores extends ListActivity{
  3.  
  4.  
  5.  
  6.         @Override
  7.  
  8.     public void onCreate(Bundle icicle) {
  9.  
  10.         super.onCreate(icicle);
  11.  
  12.        
  13.  
  14.         setContentView(R.layout.scores_list);
  15.  
  16.  
  17.  
  18.         }
  19.  
  20.  
  21.  
  22. }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


From the layout (called "scores_list.xml"):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.      android:layout_width="wrap_content"
  6.  
  7.    android:layout_height="wrap_content">
  8.  
  9.  
  10.  
  11.   <ListView android:id="@+id/android:list"
  12.  
  13.        android:layout_width="wrap_content"
  14.  
  15.        android:layout_height="wrap_content"/>
  16.  
  17. </LinearLayout>
  18.  
  19.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

Any ideas where this is going wrong?
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Top

Postby living_sword » Fri Feb 22, 2008 5:00 am

the problem is in XML. try this.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ListView
  2.  
  3. android:id="@android:id/list"
  4.  
  5. android:layout_width="wrap_content"
  6.  
  7. android:layout_height="wrap_content" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
living_sword
Junior Developer
Junior Developer
 
Posts: 23
Joined: Fri Nov 23, 2007 4:44 am

Postby ramgraph1 » Fri Feb 22, 2008 6:45 am

Thanks for your reply, but unfortunately after replacing the code as suggested I am still getting the NullPointerException...
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Getting NullPointer Exception

Postby gvkreddyvamsi » Fri Feb 22, 2008 7:02 am

Hi,

I have tried Microsoft map point application in old SDK - m3. There it worked fine.
Now in new SDK m5 iam not getting any errors in code.. But while running it gives Null Poiner Exception where the error ...i did not get through...


Thanks in advance..

by
vamsi
gvkreddyvamsi
Developer
Developer
 
Posts: 43
Joined: Mon Jan 21, 2008 5:10 am
Location: INDIA

Postby ramgraph1 » Fri Feb 22, 2008 7:54 am

Hmm. Apparently you just can't cut back on the ListAdapter code that much. I put everything back in, spent a couple of hours messing with what I had and got it working in the end...
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests