I want to just grab a picture in my app via intent from the launched app
I try to use the following code:
Intent Intent = new Intent ("Android.intent.action.GET_CONTENT"); Intent.addcategory ("Android.intent.category.OPENABLE"); Intent.settype ("image/*");
Processing methods
Id.os.Bundle; public class Stackoverflowappactivity extends Activity { private final int pick_image = 0; /** called when the activity is first created. * /@Override public void OnCreate (Bundle savedinstancestate) { super.oncreate (savedinstancestate); Setcontentview (r.layout.main); Intent i = new Intent (Intent.action_pick, Android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Startactivityforresult (i, pick_image); } @Override protected void onactivityresult (int requestcode, int resultcode, Intent data) { Super.onactivityresult (Requestcode, ResultCode, data); Switch (requestcode) {case pick_image: if (ResultCode = = RESULT_OK) { //Do your thing } }
}}}
Original address: http://www.itmmd.com/201411/188.html
This article by Meng Meng's IT person to organize the release, reprint must indicate the source.
Android Intent.settype () filter images, return all file types