How to create this ListActivity?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to create this ListActivity?

Postby E-Nature » Tue Dec 29, 2009 9:39 pm

hi all
I have a problem which probably can be solved easily - however, I do not know how :)

I have a view on which the user can select 2 parameters. after clicking a button he will be forwarded to a ListActivity which shall display values according to his previous selection. For that matter I need to send his selection as parameters to the ListActivity. I did the tutorial on the code.google.com website for the ListActivity but in this tutorial they send the whole class as a parameter. What I need is a way to pass parameters to the ListActivity.
My code currently looks like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. (CLICKLISTENER HERE)
  3.  
  4. if (v == btnConnect) {
  5.  
  6.                         try {
  7.  
  8.                                 ...
  9.  
  10.                                 // developer.android.com/guide/tutorials/views/hello-listview.html
  11.  
  12.                                 Intent explicitIntent = new Intent(CheatDatabaseAndroid.this, GameList.class);
  13.  
  14.                                 startActivity(explicitIntent);
  15.  
  16. }
  17.  
  18. }
  19.  
  20.  
Parsed in 0.039 seconds, using GeSHi 1.0.8.4


My problem is the "GameList.class" part. GameList.class is identical to the class in the tutorial at "http://developer.android.com/guide/tutorials/views/hello-listview.html".
I need to be able to pass 2 parameters to the GameList class somehow in this clicklistener-action. How can I do that?

Thanks for help in advance!
dominik
User avatar
E-Nature
Experienced Developer
Experienced Developer
 
Posts: 93
Joined: Mon Nov 16, 2009 3:39 pm

Top

Postby qlimax » Tue Dec 29, 2009 10:09 pm

look at the putExtra() method of the Intent class (call this method on your explicitIntent object to pass the param)

then getIntent().get***Extra() to retrive this params when you are in the listactivity

bye
¯`·.¸¸.><((((º>¯`·.¸¸. ><((((º>
User avatar
qlimax
Master Developer
Master Developer
 
Posts: 271
Joined: Mon Aug 31, 2009 10:54 am
Location: Swiss

Postby jwei512 » Wed Dec 30, 2009 4:04 am

if you still have questions about what qlimax said, i have some coded out examples in this post:

http://thinkandroid.wordpress.com/2009/ ... ctivities/

hope that solves your problems
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Postby E-Nature » Wed Dec 30, 2009 10:17 pm

Extremely helpful! :D
thanks a lot for the help!
User avatar
E-Nature
Experienced Developer
Experienced Developer
 
Posts: 93
Joined: Mon Nov 16, 2009 3:39 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests