그래서 1은 2 ImageButtons
, clothesButton1
, xml로 선언 된 이미지, 그리고 imageButton2
은 비어 있습니다. 둘 다 별도의 활동에 있습니다. clothesButton1
을 클릭하면 비트 맵을 사용하여 clothesButton1
의 이미지를 imageButton2
으로 옮기고 싶습니다. 이후에 clothesButton1이 비어있게됩니다. (imageButton2에 대한) 내 두 번째 활동에서별도의 액티비티에있는 ImageButton 간의 이미지 이동 onClick 비트 맵
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);
}
});
:
여기 clothesButton1
자바에서 내 코드의
final ImageButton imageButton2 = (ImageButton)findViewById(R.id.imageButton2);
Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapClothes");
imageButton2.setImageBitmap(bitmap);
이동 기능이 작동되지 않고, 난 정말 아무 생각이 곳이 없다 그러나 나는 틀렸다. 어떤 도움이라도 대단히 감사합니다.
설명과 도움에 감사드립니다. 그러나, 나는 getContext()를 사용하여 시도했지만 "메서드를 해결할 수 없습니다". 그래서 대신 작동하도록 getApplicationContext()를 사용했습니다. 다행히도 앱에 많은 차이가 있음을 의미하지는 않습니다. – xlayer
예, 귀하의 오른쪽 기쁘게 도와 드리겠습니다! – Yirga