1

I have an activity class like below

public class PInfo extends Activity {

    public ArrayList<String> getInstalledApps() {

        ArrayList<String> Apps = new ArrayList<String>();  

and non-activity class like below

public class TestSettings extends UiAutomatorTestCase {

    public void testSearch() throws UiObjectNotFoundException, IOException {

        try {
            PInfo pi = new PInfo();
            ArrayList<String> marr = pi.getInstalledApps();

When calling getInstalledApps() method, It's not working normally.

Is there any solution.

flx
  • 14,146
  • 11
  • 55
  • 70
  • http://stackoverflow.com/questions/14956018/can-i-create-the-object-of-a-activity-in-other-class. check this. do not create an instance of activity class – Raghunandan Dec 27 '13 at 06:20
  • Check the answer [here][1] create a callback interface [1]: http://stackoverflow.com/questions/19662851/how-to-call-method-in-activity-form-non-activity-class – HT03 Dec 27 '13 at 06:30

1 Answers1

1

you can make this method to be static like this --> public static .... getInstalledApps()