jeudi 19 mars 2020

How to intending another activity?

I have a recycler in MainActivity, click on some item in the recycler and it opens DetailActivity. Then in DetailActivity click to openGallery (ACTION_OPEN_DOCUMENT). I would like to intending this.

onView(withId(R.id.main_recycler))//it opens DetailActivity
            .perform(RecyclerViewActions.actionOnItemAtPosition(1, click()));
intending(hasAction(Intent.ACTION_OPEN_DOCUMENT)).respondWith(getGalleryResult());
onView(withId(R.id.visit_gallery_btn))
            .perform(click());

But this code causes an error...

androidx.test.espresso.intent.Intents.internalIntending(org.hamcrest.Matcher)' on a null object reference

How could I perform this another way?

Aucun commentaire:

Enregistrer un commentaire