is there a possibility to get the name/reference/id of the current displayed image in a ViewSwitcher?

switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);

[...]

@Override
public boolean onSingleTapUp(MotionEvent e) {
       Log.d(TAG, "tell me please, how to get the name/reference/id/etc of the currently displayed image, so i can start a specific action relating to the current image");
       return false;
}

Thanks!

Tobias

有帮助吗?

解决方案 2

Use the 'edit' button above to make changes to your question post.

As for your question, if you're using a ViewSwitcher, I think you can do with some sort of indicator to tell you which screen (which ViewGroup) is being displayed. Like an int or boolean that you're modifying when switch commands are called.

其他提示

In ViewSwitcher you can only have at max 2 views (Which are images in your case).

To get current view by getCurrentView() method

Or to get the index of current visible item by getDisplayedChild() method, which can be either 0 or 1

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top