Android Studio Debugging options

Question!

I have a really annoying bug that has crept into my android app and I can't locate the cause (although it is possibly because I upgraded to SDK 23).

I am dynamically referencing a series of ImageView elements and filling the ImageView with a bitmap:

ImageView img = (ImageView) activity.findViewById(context.getResources().getIdentifier(result.getView(), "id", context.getString(R.string.packagename)));
img.setImageBitmap(bitmap);

All of the ImageViews were filling correctly and now just one of the images is not filling (but the others are)

I suspect that the image is filling but is subsequently being either overwritten, hidden, sent to back or something else.

I have tried the debugger in Android studio that appears to confirm the ImageView is being correctly referenced and there is an image in 'bitmap' but what I can't seem to do is find if it is subsequently changed

Question Is there a way to set a debugging 'trap' to catch whenever a Resource ID is accessed (i.e. I want to know when there are changes to my R.id.inv_image



Answers

Thanks for suggestions and have now resolved problem - may be helpful to someone in the future!

I had an ImageView with and xml setting:

 android:layout_height="400dp"
 android:layout_alignBottom="@ id/value_title"

So this anchored the base of the ImageView and the 400dp height was bigger than the available space on the display (?? ImageView was sticking out of the top but truncated??)

I believe that prior to sdk 23 the bitmap I put in the box was bottom aligned and I could see it without problem as the height of the bitmap was about half the ImageView height and filled the visible ImageView perfectly.

From sdk 23 it seems the bitmap is top aligned and so the image was invisible as the bitmap was placed above the viewable region, and all I could see was the blank bottom of the ImageView.

Fixed it by reducing the height of ImageView:

 android:layout_height="106dp"


This video can help you solving your question :)
By: admin