[Solved]Android Studio -- pass view between classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[Solved]Android Studio -- pass view between classes

I am trying to pass a view between objects so I can update views(textboxes) from other classes, is this possible, or should I do it another way? https://code.sololearn.com/coTIkvpwR492/?ref=app https://code.sololearn.com/cAOmsBLKnyxv/?ref=app

23rd Aug 2020, 9:02 PM
Charlie Crease-huggett
4 Answers
+ 2
You can create a reference variable of Question_generator inside the Arithmetic_operations class. And initialize the activity reference inside onCreate method. So, that you can use findViewById method inside Arithmetic_operations to get hold of any view from your activity. Here is some code so that you can understand clearly https://code.sololearn.com/cS8y0YQjfroZ/?ref=app
29th Aug 2020, 3:54 PM
Terminal_Phantom
Terminal_Phantom - avatar
+ 1
Charlie Crease-huggett you can do it using the intent
24th Aug 2020, 8:23 AM
Dhananjay
Dhananjay - avatar
+ 1
Dhananjay intents are used to pass information between activities, how would I use intents ?
24th Aug 2020, 8:33 AM
Charlie Crease-huggett
0
Terminal_Phantom that's it, I've tried it and its worked perfectly. Thank you very much :)
30th Aug 2020, 1:02 PM
Charlie Crease-huggett