0

I am launching settings page with following code

Intent intent = new Intent(android.provider.Settings.ACTION_DATE_SETTINGS);

and then trying to get the text using

ArrayList<TextView> textLists = solo.getCurrentTextViews(this.getActivity().getCurrentFocus());

but i am getting text views of previous activity.

can anyone tell me how to get the new activity in my solo

i even tried following

Solo newSolo = new Solo(null, this.activity);

kamal_prd
  • 543
  • 4
  • 16

4 Answers4

0

I don't understand your question clearly but if you want to get a result from an Activity use the method startActivityForResult.

type-a1pha
  • 1,891
  • 13
  • 19
  • i am extending ActivityInstrumentationTestCase2, so i am using startActivity. I am launching an app(activity) then from there i am starting another activity. In the second activity i want to get the text view which i am not able to. – user1621697 Aug 27 '12 at 16:07
0

With Robotium you can only test a single application. If you start the Settings application you can't instrument it at the same time as your own application.

David Wasser
  • 93,459
  • 16
  • 209
  • 274
0

Have you tried to wait before fetching the TextViews ? Just add a Solo.sleep(5000) to make sure that the new Activity has been built completely.

Also it may be the case that you get TextViews of your previous Activity AND TextViews of your new Activity?

However it seems that you are trying to access not only another Activity in your application_under_test but one that is not within your application_under_test, namely the Settings app. This doesn't work as David Wasser already pointed out

JoachimR
  • 5,150
  • 7
  • 45
  • 50
  • yes i am trying to access the settings app from my activity. For my test case i need to switch to settings app and set some info there. Which i am not able to. – user1621697 Aug 29 '12 at 08:12
0

If your activities are in different packages you wont get response from the activity outside your AUT's package.

VivekNR
  • 41
  • 4