I’m trying to pull the path of a screen image I’m looking at on the android phone of the app im testing. The app shows various pictures. I want to pull the path of the picture to pull the picture name, but have no clue how to start. Any guidance?
edit:
I’m trying to find out if I could pull the path from the app code to see which image the user is viewing. for example. if im looking at an image, I want to know whats the path of the image (path should be coming from someone’s harddrive)
there’s not necessarily a path for an image. it’s better to say the source of the image, be it a file, an HTTP stream, or otherwise. and unfortunately, that info is lost once it’s set into an
ImageView.to set the image bits into an
ImageView, you construct aBitmap, usually using one of thedecode*()methods inBitmapFactory. that is what determines the source of the image. in your unit test framework, you can get a handle to theImageViewby getting theActivityand callingfindViewById(), but that’s not going to help you.there may be other places for you to hook into the code to determine that sources for the image data, but i can’t say without knowing your application source code.
you could ask your developers to make the source available in the
ImageView‘s tag (seesetTag()/getTag()). that way you could pull it out in your unit tests. of course, you’ll have to have an understanding with them as to what the source will be (a URL, a database URI, a file path, ?).