Solution 1: (for resources not drawable )
You can send the path file name as a string. Just like "title" in your example.
If you are having problems using the path to the ImageView file. Show image from file path?
Solution 2: (for drawable easy and easy way)
Send the value of an integer resource, for example:
PRIMARY ACTIVITY
Intent intent = new Intent(this, SecondActivity.class); intent.putExtra("resourseInt", R.drawable.image); startActivity(intent);
SECOND ACTIVITY
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.pantalla); Bundle extras = getIntent().getExtras(); if (extras == null) { return; } int res = extras.getInt("resourseInt"); ImageView view = (ImageView) findViewById(R.id.something); view.setImageResourse(res); }
source share