0

アクティビティ 1:

ImageView image=(ImageView)findViewById(R.id.imageicon);

in.putExtra("image",R.id.imageicon);

活動 2 :

int RecipeImage = in.getIntExtra("image",0);

ImageView imageview=(ImageView)findViewById(R.id.imageView1);

imageview.setImageResource(RecipeImage);

問題 :

java.lang.RuntimeException: アクティビティ ComponentInfo を開始できません{com.example.wireframe/com.example.wireframe.singlemenuitem}: java.lang.NullPointerException

4

1 に答える 1

0

2 つの異なるアクティビティで同じ画像が必要な場合は、アクティビティごとに画像を読み込んでみませんか? ところで、次の方法でドローアブルを取得します。

Drawable drawable =  this.getResources().getDrawable(R.drawable.yourImage);
于 2013-05-03T14:37:33.647 に答える