android - How to pass image from one activity to another -


activity 1:

imageview image=(imageview)findviewbyid(r.id.imageicon);  in.putextra("image",r.id.imageicon); 

activity 2 :

int recipeimage = in.getintextra("image",0);  imageview imageview=(imageview)findviewbyid(r.id.imageview1);  imageview.setimageresource(recipeimage); 

issues :

java.lang.runtimeexception: unable start activity componentinfo{com.example.wireframe/com.example.wireframe.singlemenuitem}: java.lang.nullpointerexception

if want same image in 2 different activities, why not load image each activity? btw drawable in way:

drawable drawable =  this.getresources().getdrawable(r.drawable.yourimage); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -