Wednesday, 15 August 2012

eclipse - android: how to open a file out of my app -



eclipse - android: how to open a file out of my app -

i'm developing app, should open file after decoding. so, want open file (for illustration image) picked in app default application (if there several apps kind of file 1 of apps take user).

for different file types need utilize different intents below

intent intent = new intent(); intent.settype("image/*"); intent.setaction(intent.action_get_content); startactivityforresult(intent.createchooser(intent, "open image"), 1);

or utilize next code file type file , letthe android scheme figure out app can opened with

file file = new file("example.jpg"); string mime = mimetypemap.getsingleton().getmimetypefromextension(".jpg"); //you need find extension file using split command intent intent = new intent(); intent.setaction(android.content.intent.action_view); intent.setdataandtype(uri.fromfile(file), mime); startactivityforresult(intent, 10);

android eclipse file

No comments:

Post a Comment