in Education by
I have two modules. App and module Test. Module app contains MainActivity with button. Module Test contains MainActivity two. I want to run Test/MainActivity from module app by click on button. But Android still cannot see MainActivity from module Test. See below. Module app Manifest: <?xml version="1.0" encoding="utf-8"?> Module Test manifest: <?xml version="1.0" encoding="utf-8"?> Code in Module app MainActivity for click button and run second Activity: public void runActivity(View view) { Intent intent = null; try { intent = new Intent(this, Class.forName("com.example.test.MainActivity")); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } } In Console I get an error: W/System.err: java.lang.ClassNotFoundException: com.example.test.MainActivity EDIT: In app build.gradle file I have: implementation project(path:':test', configuration:'default') EDIT 2: Here is link with complete example that not working. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You have multiple options for implementing this: 1- if Module test is a dependency for module App, then you can normally access Test/activity class from module App. 2- You can implicity start Test/Activity using intent filters & actions, See docs here and this is an example 3- If Module test have a broadcast receiver, you can send broadcast (either explicit or implicit) to it and open activity from there

Related questions

0 votes
    How can we move from one desired step to another step? (a) breakpoints (b) System.out.println (c) logger. ... & Servlet of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    I am able to modify my first spinner but not sure how to do the second one in java. Here is ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I'm not sure how exactly to phrase my question. So, I have an interface reference and I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    Which component can be used for sending messages from one application to another? (a) server (b) client (c) mq ... & Servlet of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Which of these method is used to add an element to the start of a LinkedList object? (a) add() (b ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these methods is used to obtain an iterator to the start of collection? (a) start() (b) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What does local IP address start with? (a) 10.X.X.X (b) 172.X.X.X (c) 192.168.X.X (d) ... Java Server Technologies & Servlet of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    I would really appreciate some help on what seems to be an easy error to fix, I'm a beginner and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I would really appreciate some help on what seems to be an easy error to fix, I'm a beginner and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I would really appreciate some help on what seems to be an easy error to fix, I'm a beginner and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I would really appreciate some help on what seems to be an easy error to fix, I'm a beginner and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I have two activities in my project one activity is MainActivity and another is Main2activity, In Main2activity ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I have two activities in my project one activity is MainActivity and another is Main2activity, In Main2activity ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I have two activities in my project one activity is MainActivity and another is Main2activity, In Main2activity ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 27, 2022 in Education by JackTerrance
0 votes
    I have two activities in my project one activity is MainActivity and another is Main2activity, In Main2activity ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
...