Buongiorn sto usando questo codice per accedere alle cartelle delle foto per visualizzarla poi in una ImageView.
Se lancio l' app sul mio telefonino con Android 8.0 tutto ok ma se uso il tablet con la versione 4 mi da il seguente errore.
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
Error occurred on line: 66 (Main)
java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/2329 from pid=2630, uid=10211 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1472)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:684)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1063)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:904)
at android.content.ContentResolver.openInputStream(ContentResolver.java:629)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:211)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1343)
at b4a.example.contentchooser.main._cc_result(main.java:435)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.phone.Phone$ContentChooser$1.ResultArrived(Phone.java:865)
at anywheresoftware.b4a.BA$4.run(BA.java:568)
at anywheresoftware.b4a.BA.setActivityPaused(BA.java:442)
at b4a.example.contentchooser.main$ResumeMessage.run(main.java:306)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
ho provato a caricatre la runtimepermission e mi da il seguente errore.:
Cosa devo fare?
Grazie
codice di caricamento foto:
Sub ButtonGetImage_Click
CC.Show("image/*", "Choose image")
'CC.Show("audio/*", "Choose audio file")
End Sub
Sub CC_Result (Success As Boolean, Dir As String, FileName As String)
If Success = True Then
ImageView1.Bitmap = LoadBitmap(Dir,FileName)
Else
ToastMessageShow("No Success :(",True)
End If
End Sub
Se lancio l' app sul mio telefonino con Android 8.0 tutto ok ma se uso il tablet con la versione 4 mi da il seguente errore.
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
Error occurred on line: 66 (Main)
java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media/2329 from pid=2630, uid=10211 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1472)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:684)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1063)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:904)
at android.content.ContentResolver.openInputStream(ContentResolver.java:629)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:211)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:516)
at anywheresoftware.b4a.keywords.Common.LoadBitmap(Common.java:1343)
at b4a.example.contentchooser.main._cc_result(main.java:435)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.phone.Phone$ContentChooser$1.ResultArrived(Phone.java:865)
at anywheresoftware.b4a.BA$4.run(BA.java:568)
at anywheresoftware.b4a.BA.setActivityPaused(BA.java:442)
at b4a.example.contentchooser.main$ResumeMessage.run(main.java:306)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
ho provato a caricatre la runtimepermission e mi da il seguente errore.:
Cosa devo fare?
Grazie