I have a click event that is shown in my list view.
int [] GenusListIDs = {R.id.txt_ID, R.id.txt_Genus, R.id.txt_Count}; SimpleCursorAdapter Adapter = New SimpleCursorAdapter (this, R.layout.genusitem, cursor_genuslist, service.GenusListColumns, GenusListIDs); ListView list_Genus = (ListView) findViewById (R.id.list_Genus); List_Genus.setAdapter (adapter); List_Genus.setOnItemClickListener (New OnItemClickListener) {@Override Public Zero onItemClick (View AdapterView Parents, View, Integer Status, Long ID) {{Log.println (1, "ItemClick" Try, view.toString ()); TextView TV = (TextView) view; String Genus = (string) tv.getText (); I = new intent (getBaseContext (), Cat_Species.class); // new intent (this, Total.class); / * view I.putExtra ("id", id), * / startActivity (i);} hold (exception pre) {Log.println (1, "item click event", ex.getMessage ());}}}); I need to pass a string based on the new intent, on which they clicked the list. The value I want to pass is in the list, which is called txt_Genus, how do I get the value from getting it out of the list? Please do not pay attention to my experiments.
It should do this.
TextView TV = (TextView) view.findViewById (R.id.txt_Genius); String genus = TV.get text (). ToString (); Then put this intent into extras, I think you already know this bit
i.putExtra ("talent", talent ). Edit;
In your new activity, you can use the intent and get additional bundles. You can access anything you keep in mind on your previous activity like the following;
Bundle Extras = Milentant (). GetExtras (); String genius = extras.getString ("talent"); // To show the value of some toast pop talent - not necessarily but it works: Toast.makeText (this, "talent value:" + talent, toast.LENGTH_SHORT) .show ();
Comments
Post a Comment