I'm trying to send an image from a activity to another, i was reading similar questions but none solved my problem. The code I am using to send this picture is
public void aceptar (View view) {
ImageView iv = (ImageView) findViewById(R.id.foto);
iv.setImageBitmap(BitmapFactory.decodeFile(foto));
File file = new File(foto);
Intent intent = new Intent(this, XMPPClient.class);
ImageView img_view = (ImageView) findViewById(R.id.foto);
img_view.setBackgroundResource(intent.getIntExtra("foto",1));
startActivity(intent);
}
and to receive the image
Bundle extras = getIntent().getExtras();
if (extras == null)
{
return;
}
int res = extras.getInt("resourseInt");
ImageView foto = (ImageView) findViewById(R.id.foto);
view.setBackgroundResource(res);
the error is this
FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3606)
at android.view.View.performClick(View.java:4211)
at android.view.View$PerformClick.run(View.java:17446)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5336)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)