Showing posts with label Buttons. Show all posts
Showing posts with label Buttons. Show all posts

Using Buttons in Android apps development

This Tutorial shows how to use Buttons in  Android apps development

1,Drag & Drop Button from Eclipse IDE
2,Select Properties and Assign name & Text Size
3,Right Click on button & select Edit ID ,Ex :Button3
4,Link this Button3 to Java by
//Start of Existing code
protected void onCreate(Bundle savedInstanceState) {   //Executes when app launched
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);            //Running Main.xml

//End of Existing code

//Start > Adding Button click event
Button Button3=(Button)findViewById (R.id.Button3);
 Button3.setOnClickListener(new View.OnClickListener() 
{
public void onClick(View v) {
// TODO Auto-generated method stub //Write your Code here
startActivity(new Intent ("com.mani.Convertor.TutorialOne")); //In my case I opened new Class
}
});
//End > Adding Button click event





^ Top