habe ich die Erlaubnis, auf dem manifest.xmlPermission Denial: Lesen com.android.providers.media.MediaProvider uri Inhalt: // media/extern/images/media/38
Aber ich immer noch mit den gleichen Fehler :
Permission Denial: reading com.android.providers.media.MediaProvider
Hilf mir bitte.
Meine Java-Klasse
package com.example.maymaa.mytest;
+import..
public class Image extends AppCompatActivity {
private static final int PICK_IMAGE =100;
Uri imageUri;
ImageView imageview1;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image);
imageview1=(ImageView)findViewById(R.id.imageview1);
button=(Button)findViewById(R.id.btphoto);
assert button != null;
button.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
openGallery();
}}
);}
private void openGallery()
{
Intent gallery= new Intent
(Intent.ACTION_PICK,MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(gallery, PICK_IMAGE);
}
@Override
protected void onActivityResult
(int requestcode,int resultcode,Inten data)
{
super.onActivityResult(requestcode,resultcode,data);
if(resultcode == RESULT_OK && requestcode==PICK_IMAGE){
imageUri =data.getData();
imageview1.setImageURI(imageUri);
}
}
}
Meine Tätigkeit
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:padding="10dp"
android:weightSum="1">
<ImageView
android:layout_width="361dp"
android:layout_height="255dp"
android:id="@+id/imageview1"
android:layout_weight="0.14" />
<Button
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="Choisir"
android:layout_gravity="center_horizontal"
android:onClick="btnclick"
android:id="@+id/btphoto"
/>
</LinearLayout>
ist mein Code nicht arbeiten Danke
HTML wird nie Fehler werfen. – Justinas
Sorry, ich habe eine Störung:/bei Android –
Ihre Verwendung Marshmallow? –