I am using 3 classes A, B and C. In class A I created a method clickButton() and In class B I used onClick() for a button. while clicking on the button it has to call the method clickButton() in Class A, and inside the clickButton() i wrote intent for initiating the class C.
The problem is I couldn’t able to call the Class A method in class B.
You generally don’t want to touch another
Activitydirectly. The Android design paradigm represents a largely separated viewpoint between different activities, and so instead of directly calling methods on a classA, you will send it anIntentor message or something. If you have a utility method, you should consider moving them into a shared class and making them static. If you have something that needs to be performed in the background or shared persistent store, you should consider moving to a service or content provider.