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 } } } } }
原文地址:http://www.itmmd.com/201411/188.html
该文章由 萌萌的IT人 整理发布,转载须标明出处。
android Intent.setType() 过滤图片,返回所有的文件类型
原文地址:http://blog.csdn.net/androidmylove/article/details/42149267