Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check existence of a fragment using Robotium - Android

Is anyone aware of a way to check the existence of fragment using Robotium?

Regards Rc

like image 403
Rc N Avatar asked Oct 14 '11 06:10

Rc N


1 Answers

I'm assuming that you want to find the existence of a fragment that you know the activity or tag for.

first call getCurrentActivity() on Solo and then call

getFragmentManager().findFragmentById()

or

getSupportFragmentManager().findFragmentById()

if you're using the v4 compatibility library. That will search all the fragments on the page and return it. You can also use findFragmentByTag() if you've previously tagged the Fragment.

like image 184
Avi Cherry Avatar answered Oct 01 '22 15:10

Avi Cherry