2017-07-25 4 views
-5

Keine Fehlermeldung im Android Studio. 'Bildauswahlknopf' reagiert nicht, wenn Sie darauf klicken.Knopf, der nichts tut

Ich habe bei ähnlichen Fragen gesucht, aber keine sind mein Problem spezifisch und nicht

XML-Datei half:

<de.hdodenhof.circleimageview.CircleImageView 
     android:layout_width="85dp" 
     android:layout_height="85dp" 
     android:src="@drawable/noprofileimg" 
     android:id="@+id/profilepic" 
     android:layout_marginBottom="37dp" 
     android:layout_alignBottom="@+id/imageView" 
     android:layout_centerHorizontal="true" /> 
<Button 
    android:id="@+id/pick_image_button" 
    android:layout_width="80dp" 
    android:layout_height="23dp" 
    android:text="Pick Image" 
    android:textSize="12dp" 
    android:padding="0dp" 
    android:background="@color/Gray" 
    android:layout_marginBottom="13dp" 
    android:layout_above="@+id/linearLayout" 
    android:layout_centerHorizontal="true" 
    android:onClick="onClick" 
    /> 

Aktivität Datei,

public class uploadprofileimg extends ActionBarActivity{ 


private static final int PICK_IMAGE = 100; 
private ImageView imageView; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_profile); 

    imageView = (ImageView) findViewById(R.id.profilepic); 

    Button pickImageButton = (Button) findViewById(R.id.pick_image_button); 
    pickImageButton.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      openGallery(); 
     } 
    }); 
} 

private void openGallery() { 
    Intent gallery = 
      new Intent(Intent.ACTION_PICK, 
        android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); 
    startActivityForResult(gallery, PICK_IMAGE); 
} 

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
    super.onActivityResult(requestCode, resultCode, data); 
    if (resultCode == RESULT_OK && requestCode == PICK_IMAGE) { 
     Uri imageUri = data.getData(); 
     imageView.setImageURI(imageUri); 
    } 
} 

}

Hier ist mein Logcat:

07-25 11:51:36.776 28107-28107/com.liamthedeveloper.foodiez E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]] 07-25 11:51:36.776 28107-28107/com.liamthedeveloper.foodiez V/BoostFramework: BoostFramework() : mPerf = null 07-25 11:51:37.080 28107-28107/com.liamthedeveloper.foodiez D/[email protected][ProfileActivity]: ViewPostImeInputStage processPointer 
+0

benannt haben. Bitte fügen Sie Ihr logcat hinzu. – Akriti

+0

@Akriti 07-25 11: 51: 36,776 28107-28107/com.liamthedeveloper.foodiez E/BoostFramework: BoostFramework(): Exception_1 = java.lang.ClassNotFoundException: Die Klasse "com.qualcomm.qti.Performance" wurde nicht gefunden auf Pfad: DexPathList [[], nativeLibraryDirectories = [/ system/lib64,/Hersteller/lib64]] 07-25 11: 51: 36.776 28107-28107/com.liamthedeveloper.foodiez V/BoostFramework: BoostFramework(): mPerf = null 07-25 11: 51: 37.080 28107-28107/com.liamthedeveloper.foodiez D/ViewRootImpl @ 435aa35 [ProfilActivity]: ViewPostImeInputStage processPointer 1 – liam

+5

Fügen Sie es der Frage hinzu. Und ein Wort von ** warning **: niemals Inhalt aufstellen, wie du es gerade mit diesem "Müll" Inhalt getan hast, "stell dich auf ..." Ich denke, du weißt, wovon ich rede. – GhostCat

Antwort

5

Entfernen Sie android:onClick="onClick" von Schaltfläche Tag in XML.

+1

Ja, entfernen Sie das ... onClickListener ist bereits durch (Java) Code gemacht! – deHaar

1

Sie hatten sowohl onclicklistener als auch onclick-Attribut für dieselbe Aktivität. Sie können einfach onclick entfernen oder einfach "onclick" in opengallery ändern, zu dem Sie die Methode