android - Open Gallery Folder By Click On Notification -
i used code send notification.
public static void sendnotificationphoto(context context, class<?> activitytarget) { log.i( tag , "send photo notification"); notificationmanager mnotificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); notification notifydetails = new notification(r.drawable.ic_plusone_standard_off_client, "new alert!", system.currenttimemillis()); intent intent = new intent(context, activitytarget); int id = notification_id_photo; string contenttext = "slave picture available!"; pendingintent contentintent = pendingintent.getactivity(context.getapplicationcontext(), id, intent, pendingintent.flag_one_shot); notifydetails.setlatesteventinfo(context.getapplicationcontext(), context.getstring(r.string.app_name), contenttext, contentintent); mnotificationmanager.notify(id, notifydetails); }
but don't need open activity specific gallery's folder. possibile notification?
you can
intent intent = new intent(intent.action_view,imageuri); imageuri = "content://media/external/images/media/1210"`
call intent in pendingintent
pendingintent contentintent = pendingintent.getactivity(context.getapplicationcontext(), id, intent, pendingintent.flag_one_shot );
the above imageuri representation. worked me after several tries other options. intent doesnot work if supply file.getpath
or file.getabsolutepath
i've tried using uri.fromfile
, worked:
intent = new intent(intent.action_view,uri.fromfile(filename));
Comments
Post a Comment