so 1は2 ImageButtons
,clothesButton1
、xmlで宣言された画像を持ち、imageButton2
は空白です。両方とも別々の活動に入っています。 clothesButton1
をクリックすると、ビットマップを使用してclothesButton1
の画像をimageButton2
に移動します。その後、clothesButton1は空白になります。ここで別個のアクティビティでの画像ボタンの移動onClickビットマップ
はclothesButton1
のためにJavaで私のコードです:
final ImageButton clothesButton1 =(ImageButton)findViewById(R.id.clothesBtn1);
clothesButton1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
clothesButton1.buildDrawingCache();
Bitmap bitmapclothes = clothesButton1.getDrawingCache();
Intent intent = new Intent();
intent.putExtra("BitmapClothes", bitmapclothes);
}
});
:
final ImageButton imageButton2 = (ImageButton)findViewById(R.id.imageButton2);
Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapClothes");
imageButton2.setImageBitmap(bitmap);
移動機能が動作していないと私は本当にどこ見当がつかないしかし、私は間違っています。どんな助けでも大歓迎です。
説明と助けをありがとう!しかし、私はgetContext()を使ってみましたが、 "メソッドを解決できません"。だから、私は代わりにgetApplicationContext()を使用して動作させました。うまくいけば、それはアプリのための多くの違いを意味するものではありません。 – xlayer
はい、あなたの右嬉しい助け! – Yirga