onclick open new view

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

Re: onclick open new view

Postby dutch85 » Wed Jun 30, 2010 6:07 am

you're right i didn't but when i do my code like so,

Code: Select all
public class main extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);


i receive

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.dutch.spr/org.dutch.spr.main}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Top

Re: onclick open new view

Postby dutch85 » Wed Jun 30, 2010 11:48 am

I have noticed something else quite odd toast notifications work fine with my code while setcontentview and AlertDialog both receive the same error: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

i have also realized that the error sits in this line right hear

setContentView(org.dutch.spr.R.layout.main);

if its located in oncreate the app crashes at startup in its in onlistitemclicked the app crashes when listitem is clicked
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Re: onclick open new view

Postby anarche » Thu Jul 01, 2010 12:17 am

ok setContentView should be in onCreate. Sorry I didnt get back to you last night, I wound up out on the town.

All this still points to the id of the list..
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: onclick open new view

Postby dutch85 » Thu Jul 01, 2010 6:18 am

so I am still stuck on what is causing my "java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'" error when setcontentview is called
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Re: onclick open new view

Postby anarche » Thu Jul 01, 2010 10:38 am

Ok then, I've copy-pasted your code and it's run first shot ;p

I initially took out the onListItemClick, presto. Put it back in and used a quick Log and it was capturing events fine.

I have no import R.* at all... and the xml is quite literally a copy-paste
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: onclick open new view

Postby dutch85 » Fri Jul 02, 2010 12:42 am

I'm not sure I understand what you did to make it work can you post main.java here for me
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Top

Re: onclick open new view

Postby anarche » Fri Jul 02, 2010 12:48 am

I' m at work, but I did literalyy copy your code and paste it into my project.

Try the Ctrl-Shift-O and see what it does to the imports in your Activity
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: onclick open new view

Postby dutch85 » Fri Jul 02, 2010 1:08 am

wow i feel like a complete retard haha I tried Ctrl-Shift-O that cleaned up my imports but i still get the same error.
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Re: onclick open new view

Postby anarche » Fri Jul 02, 2010 2:03 am

In that case dude, I don't really know what else to do.

I'll post all of my code tonight, buuuttt......
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: onclick open new view

Postby dutch85 » Sun Jul 04, 2010 1:52 am

I was thinking what are your project settings this may be where my issue sits
dutch85
Developer
Developer
 
Posts: 39
Joined: Tue Apr 06, 2010 12:31 am

Re: onclick open new view

Postby anarche » Sun Jul 04, 2010 3:49 am

Yeah maybe. Try creating a new project, copy paste your code without the imports, use Ctrl-Shift-O to organise imports and see what happens
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Top
Previous

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 21 guests