filipe.madureira Posted August 28, 2012 Share Posted August 28, 2012 Hi, I have 2 classes that extend "Activity", MyActivityA.java and MyActivityB.java. How do I start MyActivityB from MyActivityA and access its variables? Comming from C++ I would expect something like: ... { MyActivityB actB=new MyActivityB(); actB.varX="Hello"; actB.startActivity(new Intent(this, MyActivityB.class)); } But this doesn't work. It throws an exception. By searching online I allways see starting an activity like this: ... { startActivity(new Intent(this, MyActivityB.class)); //But now how do I get an instance to MyActivityB class that was started? } I would really prefer to access the MyActivityB class public variables. I know of passing parameters in the Intent using putExtra(), but I am looking for an alternative because of the complexity of the project that I am not going to discuss about here. Thanks Quote Link to comment Share on other sites More sharing options...
lol Posted August 17, 2013 Share Posted August 17, 2013 the same problem, how to get an instance of created Activity after startActivity, nobody knows?!?! Quote Link to comment Share on other sites More sharing options...
John Dave Posted September 17, 2013 Share Posted September 17, 2013 I also need a way to get the instances for created activities. Any help or guidance would be enough Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.