Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Activity found to handle Intent act=android.intent.action.OPEN_DOCUMENT

I am following a tutorial and I have this error please help

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT cat=[android.intent.category.OPENABLE] typ=image/* }"

my class

public class Load_Image_Activity extends AppCompatActivity {

  private static final int REQUEST_OPEN_RESULT_CODE = 0;
   ImageView image;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_load__image_);

      image=(ImageView)findViewById(R.id.imageView2);

    Intent intent=new Intent(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image/*");
    startActivityForResult(intent,REQUEST_OPEN_RESULT_CODE);
 }
}

manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.app.soulhi.slider">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".Load_Image_Activity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
like image 711
soulhi salah Avatar asked Oct 28 '25 17:10

soulhi salah


1 Answers

ACTION_OPEN_DOCUMENT was only added to the Android SDK with Android 4.4 (API Level 19). Use ACTION_GET_CONTENT on older devices.

This is covered somewhat in the documentation on the Storage Access Framework.

like image 112
CommonsWare Avatar answered Oct 31 '25 07:10

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!