1.  Create button in XML file.

            <Button
                android:id="@+id/contact"
                android:text="CONTACT US"
                style="@style/GreenButton"
                android:minWidth="240dp"/>
 


2. Get button object from id created in xml file

Button aContactButton = (Button)findViewById(R.id.contact);

3. Set button click listener.

aContactButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                
                
            }
        });

 

Share this: