SoFunction
Updated on 2025-04-11

How to open local image on android

This article describes how to open local images on Android. Share it for your reference. The details are as follows:

Method 1: Call the image browsing tool installed on your mobile phone to browse:

Intent intent = new Intent();
("image/*");
(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 1);

Method 2: Call the mobile phone's own image browsing tool to browse:

Intent intent = new Intent(
  Intent.ACTION_PICK,
  .EXTERNAL_CONTENT_URI);
  ("image/*");
  PackageManager manager = getPackageManager();
  List<ResolveInfo> apps = (intent,
   0);
  if (() > 0) {
   startActivityForResult(intent, 0x2001);
  }

Just write the above code into the onClick event!

I hope this article will be helpful to everyone's Android programming design.