This is the ListView
and what I want is that when I click on any of the list item it opens in another Activity.
So far all TextView
texts are passing from MainActivity
to the ResultActivity
but I'm not able to send the image.
MainActivity
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TextView description = (TextView) view.findViewById(R.id.book_description);
TextView title_ = (TextView) view.findViewById(R.id.book_title);
TextView isbn_ = (TextView) view.findViewById(R.id.book_isbn);
String _title = title_.getText().toString();
String _isbn = isbn_.getText().toString();
String _description = description.getText().toString();
Intent myIntent = new Intent(MainActivity.this, ResultActivity.class);
myIntent.putExtra("title", _title);
myIntent.putExtra("isbn", _isbn);
myIntent.putExtra("description", _description);
startActivity(myIntent);
}
});
ResultActivity
public class ResultActivity extends ActionBarActivity {
TextView title, isbn, description;
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
title=(TextView) findViewById(R.id.r_title);
isbn=(TextView) findViewById(R.id.r_isbn);
description=(TextView) findViewById(R.id.r_description);
title.setText(getIntent().getStringExtra("title"));
isbn.setText(getIntent().getStringExtra("isbn"));
description.setText(getIntent().getStringExtra("description"));
description.setMovementMethod(new ScrollingMovementMethod());
}
}