I have 2 classes, Main as main activity and DrawView (extends View) as a class where I have part of menu. I use class DrawView ONLY in main.xml file, what shows this menu part (kind of slider). In this DrawView is integer variable like ‘currentSelection’.
How I can have access to this variable? I need later send this value to the second activity.
I have 2 classes, Main as main activity and DrawView (extends View) as a
Share
You could use
findViewById(R.id.give_the_custom_view_an_id)in the mainActivity‘sonCreate()method and get a reference to your custom view and the access then variable.