我想检查在xml中附加了哪个图像资源到ImageView
,我可以检查哪个图像资源附加到图像视图上,但我的要求是如何检查ImageView
是否具有与我在xml中设置的相同资源,根据这个我需要执行一些操作。代码总是执行else部分。以下是我的代码:
if (regProfile.getDrawable() == getResources().getDrawable( R.drawable.ivpic))
{
Toast.makeText(_con, "Image is ivPic", Toast.LENGTH_LONG).show();
// new RegisterAsyntaskNew().execute();
}
else
{
Toast.makeText(_con, "Image isn't ivPic", Toast.LENGTH_LONG).show();
// new RegisterAsyntask().execute();
}