java - Start intent "silently" -


following on this question, there way start intent in android without prompting user anything?

right now, retrieving image this:

public void changeimage(view view) {     intent intent = new intent();     intent.settype("image/*");     intent.setaction(intent.action_get_content);     startactivityforresult(         intent.createchooser(intent, getresources().getstring(r.string.select_picture)),         pick_image); } 

then store uri, , when necessary display image (i resize first, doesn't matter):

uri _uri = uri.parse(_path); inputstream imagestream = null; try {     imagestream = getcontentresolver().openinputstream(_uri); } catch (filenotfoundexception e) {     e.printstacktrace(); } bitmap b = bitmapfactory.decodestream(imagestream); iv.setimagebitmap(b); 

i retrieve image data given uri "silently" invoking intent relevant permission. need like:

edit:

i tried setpackage() method. code has following behavior:

  • if action_view intent used, gallery opens , shows specific image.

  • if action_get_content intent used, prompted pick image gallery, though supply specific uri.

>

uri _uri = uri.parse(_path); inputstream imagestream = null; bitmap b = null; try {     imagestream = getcontentresolver().openinputstream(_uri);     b = bitmapfactory.decodestream(imagestream);     imageview iv = (imageview) findviewbyid(r.id.playerimage);     iv.setimagebitmap(b); } catch (filenotfoundexception e) {     e.printstacktrace(); } catch (securityexception e) {     e.printstacktrace();      intent dummyintent = new intent(intent.action_get_content);     //intent dummyintent = new intent(intent.action_view);     dummyintent.setdataandtype(_uri,"image/*");     dummyintent.setpackage("com.google.android.gallery3d");      startactivityforresult(dummyintent, pick_image); } 

any ideas?

you have different types of intents, silent ones broadcast , service intents. , silent mean there's nothing visible going on user default (no activity launched).

an intent ask system: there capable of handling it? if there is, pass (or in case of multiple options ask user). , have no control after unless what's handling code.

your problem picasa.

when user pick image picasa uri. can use uri contentresolver image. what's happening when contentprovider picasa process uri , return inputstream image.

from other question understood not image, instead save uri in database , later process it.

since picasa use permission mechanism provide image , since permission expired when try use uri want obtain uri (along permission) again picasa without asking user again.

the problem picasa in control on permission , if picasa not provide intent obtain permission knowing uri there's nothing can do.

this not bug in opinion: have permission access image when user decide so, not automatically permission access every image picasa. service "silently" provide permission access every picasa image knowing uri let image user without him knowing. not picasa developers wants.

the best suggestion can give same 1 got in other question: when user chose image obtain , save locally, use local uri access image.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -