i have Listview with images and text and i can to show image and text with list.setOnItemClickListener method, when i click listview item then open new activity and i can to show Details. on second activity i have One button (Go back) and i want when i click this button listview would be position which i clicked first time for example if i clicked listview 5 items and then when i click Back button i want to this 5 item would be first position
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
journal = (TextView) view.findViewById(R.id.smalljournal);
tittle = (TextView) view.findViewById(R.id.smalltitle);
description = (TextView) view
.findViewById(R.id.smallDescription);
smalllink = (TextView) view.findViewById(R.id.smalllink);
DateTime = (TextView) view.findViewById(R.id.smallDateTime);
smallstatID = (TextView) view
.findViewById(R.id.smallstatID);
String Stringjournal = journal.getText().toString();
String Stringtittle = tittle.getText().toString();
String Stringdescription = description.getText().toString();
String Stringlink = smalllink.getText().toString();
String StringdateTime = DateTime.getText().toString();
String StringstatID = smallstatID.getText().toString();
HideKeyBoadr();
Intent in = new Intent(MainActivity.this, Result.class);
in.putExtra("KEY_journal", Stringjournal);
in.putExtra("KEY_title", Stringtittle);
in.putExtra("KEY_description", Stringdescription);
in.putExtra("KEY_link", Stringlink);
in.putExtra("KEY_pubDate", StringdateTime);
in.putExtra("KEY_statID", StringstatID);
String url = itemList.get(position).get(
MainActivity.KEY_image);
if (url.endsWith("-c.jpg"))
url = url.replace("-c.jpg", ".jpg");
in.putExtra("Bitmap", url);
startActivity(in);
overridePendingTransition(R.anim.trans_left_in,
R.anim.trans_left_out);
finish();
}
});
}
second activity
BackButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent in = new Intent(Result.this, MainActivity.class);
startActivity(in);
overridePendingTransition(R.anim.trans_right_in,
R.anim.trans_right_out);
finish();
}
});
program working perfect but when i click back button listview is showing again.....