I am new to android and trying to create a small application.
my java file:
//creating object for imagebutton class ImageButton mainButton = (ImageButton) findViewById(R.id.imageButtonone); //creating onclick listener mainButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //show message Toast toast = Toast.makeText(SkeletonActivity.this, "Button Pressed", Toast.LENGTH_LONG); toast.show(); } });
XML:
<ImageButton android:id="@+id/imageButtonone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/dog8" />
where imageButton id = imageButtonone.
I can not type "Button pressed." Please, help!
source share