Android share intent from intentservice -
i want share multiple images app other apps. on android's developer page, found:
intent shareintent = new intent(); shareintent.setaction(intent.action_send_multiple); shareintent.putparcelablearraylistextra(intent.extra_stream, savedimages); shareintent.settype("image/*"); startactivity(intent.createchooser(shareintent, "share images to.."));
how can use code intentservice? when using sample code intentservice, app crashes logcat error:
calling startactivity outside of activity context requires flag flag_activity_new_task
so added
shareintent.setflags(intent.flag_activity_new_task);
but still same error , app crashes.
how can use share intent intentservice?
this line of code
startactivity(intent.createchooser(shareintent, "share images to.."));
that means create intent object used start dialog activity user choose activity handle shareintent. so, in case intent show chooser dialog activity need flag flag_activity_new_task
can try:
intent chooserintent = intent.createchooser(shareintent, "share images to.."); chooserintent.addflag(intent.flag_activity_new_task); startactivity(chooserintent);
Comments
Post a Comment