android - How to differentiate between two images(drawable) placed on same imageView -


When writing a robotium test case, I want to differentiate between the two images placed on the same image. Drawables are dynamically placed, I have tried to get drawables with the help of a dragable (), but each time the different drawable object is coming.

Is there a way to get the drawable ID? Any help or guidance will be appreciated well

You do not get yourself from the Drawable ID You can store and retrieve drawables by using the SetTag () and getTag () methods to view imageView ID.

TestActivity.java
  extends the test of public class to test activity activity {Private Static String TAG = "Test Activity"; Personal activity mActivity; Private static id ID_TAG = 100; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_test); Log D. (Tag, "On Crate"); Mactivity = this; // Set Graphical Image View imgView = New ImageView (mActivity); ImageView.setImageResource (R.drawable.photo); String Value = String Format ("% d", R.drawable.photo); ImageView.setTag (ID_TAG, value); // Get Worthy Price = imageView.getTag (ID_TAG); DrawableId = integer.parseant (value); If (drawableId == R.drawable.photo) {Log D. (Tag, "you got the photo"); }}}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -