实例讲述android打开本地图像的方法。分享给大家供大家参考。具体如下:
方法一,调用手机安装的图像浏览工具浏览:
Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, 1);
方法二,调用手机自身图像浏览工具浏览:
Intent intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); PackageManager manager = getPackageManager(); List<ResolveInfo> apps = manager.queryIntentActivities(intent, 0); if (apps.size() > 0) { startActivityForResult(intent, 0x2001); }
时间: 2024-11-05 19:12:21