无法在android中从drawable获取imageview时显示第二个图像

无法在android中从drawable获取imageview时显示第二个图像,android,bitmap,drawable,Android,Bitmap,Drawable,我是android新手,我正在从两个不同的按钮上的drawable文件夹中获取两个不同的图像,单击不同的imageview。单击按钮时,第二个图像无法显示在第二个图像视图中 enter code here tool1=(Button)findViewById(R.id.tool11); tool2=(Button)findViewById(R.id.tool12);

我是android新手,我正在从两个不同的按钮上的drawable文件夹中获取两个不同的图像,单击不同的imageview。单击按钮时,第二个图像无法显示在第二个图像视图中

            enter code here


                    tool1=(Button)findViewById(R.id.tool11);
                    tool2=(Button)findViewById(R.id.tool12);
                    tool1.setOnClickListener(this);
                    tool2.setOnClickListener(this);
     case R.id.tool11://this is my button onclicklistener
                            d= getResources().getDrawable(R.drawable.happy);//drawable
                            myImage1 = (ImageView) findViewById(R.id.imageView2);
                            myImage1 .setImageResource(R.drawable.happy);
                            myBitmap1 = Bitmap Factory.decodeResource(getApplicationContext().getResources(),
                                    R.drawable.happy);
                   case R.id.tool12:
        d1= getResources().getDrawable(R.drawable.cool);
                            myImage2 = (ImageView) findViewById(R.id.imageView3);
                            myImage2.setImageResource(R.drawable.cool);
                            myBitmap2 = BitmapFactory.decodeResource(getApplicationContext().getResources(),
                                    R.drawable.cool);
                                Toast.makeText(getApplicationContext(), "Image Selected", Toast.LENGTH_SHORT).show();        

请回答我的问题

添加
中断在每个选择案例的末尾。

当您使用开关案例块时

case R.id.tool1:
// functionality
  Break;
case R.id.tool2:
 //functionality
Break;

使用大小写后中断。

我添加了,但当我单击tool12时,它也是强制关闭的。在您的代码中,您编写了myBitmap1、myBitmap2,您在哪里使用它们。Bitmap mBackground=Bitmap.createBitmap(myBitmap.getWidth()、myBitmap.getHeight()、myBitmap.getConfig());mCanvas=新画布(mBackground);drawBitmap(myBitmap,new Matrix(),null);drawBitmap(myBitmap1,x-dx,y-dy,null);drawBitmap(myBitmap2,x-dx,y-dy,null);我添加了中断,然后也不工作。当我点击tool12时,它是强制关闭的。什么是Logcat错误?请也分享整个方法,包括你的代码。我添加了中断,然后也不工作。当我点击tool12时,它是强制关闭的