Pregunta

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

¿Fue útil?

Solución 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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top