Reputation: 11
I have wrote a code for read onclick item on android adapter view,
String s = (lv.getItemAtPosition(position).toString());
and I am passing that s using
i.putExtra("myvalues", s);
On my second class page display this output like this:
{description=description about selected, title=selected title}
I just want to know how display description and title separately.
eg:
Selected Title ( display on one TextView ) description about selected ( display on another TextView)
--- class one ------------
public void onItemClick(AdapterView parent, View view, int position, long id) {
String s = (lv.getItemAtPosition(position).toString());
Intent i=new Intent(PageOne.this, PageTwo.class);
i.putExtra("name", s);
startActivity(i);
}
----------------- page two ------------------
I am catch that value:
TextView Textv = (TextView) findViewById(R.id.singleidview);
Intent iin = getIntent();
Bundle b = iin.getExtras();
if (b != null) {
String j = (String) b.get("name");
Textv.setText(j);
}
Upvotes: 0
Views: 147
Reputation: 1459
i think you are talking about this
String parts[] = yourstring.split(",");
parts[0] gives first string as description set this in first textview
parts[1] gives your title set this in second textview
Upvotes: 0