How to get the image name of the ImageView in Android?

前端 未结 4 669
轮回少年
轮回少年 2020-12-16 22:15

I have an imageview in android . I want to get the name of the image which is set in the in the imageview. How can I do that ?

ImageView v = (ImageView)find         


        
4条回答
  •  温柔的废话
    2020-12-16 22:53

    Couldn´t you use something like this?

    ImageView v = (ImageView)findViewbyId(R.id.img);
    if(R.id.someId == v.getId())
    {
       //do something
    } 
    else{
       //do something
    }
    

    It´s easier than use resources' names.

提交回复
热议问题