Use the extra feature of intents. Pass the value as an extra, ans retrieve it on the other side.
Thanks Raghav Sood Sent from my Nexus S On May 21, 2012 1:00 PM, "superpsycho" <s.thues...@gmx.de> wrote: > Hi, > i´ll want to call the NextActivity, give an integer to its creation > and identify whats to create by the given int. > My existing code is like: > > 1. Intent dosth = new Intent(ThisActivity.this, NextActivity.class); > 2. startActivity(dosth); > > what i simply want to have is: > > 1. Intent dosth = new Intent(ThisActivity.this, > NextActivity(integervalue).class); > 2. startActivity(dosth); > > The called activity looks like this at the moment: > > 1.public class NextActivity extends ListActivity{ > 2. private final int idoflist; > 3. > 4. public NextActivity(Integer idoflist) { > 5. this.idoflist = idoflist; > 6. } > 7. @Override > 8. public void onCreate(Bundle savedInstanceState) { > 9. super.onCreate(savedInstanceState); > 10. final String[] text = > getResources().getStringArray(R.array.text_array); > 11. setListAdapter(new ImagedArrayAdapter(this, beverages, > idoflist)); > 12. > 13. ListView listView = getListView(); > 14. listView.setTextFilterEnabled(true); > 15. > 16. listView.setOnItemClickListener(new > OnItemClickListener() { > 17. public void onItemClick(AdapterView<?> parent, > View view, > int position, long id) { > 18. System.out.println(id); > 19. } > 20. }); > 21. > 22. } > 23.} > > the actual problem is that the > 1. Intent dosth = new Intent(ThisActivity.this, > NextActivity(integervalue).class); > doesn´t work like expectet cause i don´t know what i have to do :D > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en