YOUR XML FILE SHOULD BE LIKE THIS
named as activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="contctsofvips.fun.stack.com.buttonclick.MainActivity"> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/apps"
android:id="@+id/btn1" />
</RelativeLayout>
Your Main Activity should be Like this
named as ActivityMain
package contctsofvips.fun.stack.com.buttonclick; package contctsofvips.fun.stack.com.buttondesign; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import com.dd.processbutton.iml.ActionProcessButton; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get the button view public void onClick(View view) { // Do Your Code } } }); } }