Presentation is loading. Please wait.

Presentation is loading. Please wait.

New Activity On Button Click via Intent. App->res->Layout->Blank Activity A new xml file is created and a new class is added to java folder. In manifest.xml.

Similar presentations


Presentation on theme: "New Activity On Button Click via Intent. App->res->Layout->Blank Activity A new xml file is created and a new class is added to java folder. In manifest.xml."— Presentation transcript:

1 New Activity On Button Click via Intent

2 App->res->Layout->Blank Activity A new xml file is created and a new class is added to java folder. In manifest.xml file, A new activity is added. Copy intent filter and paste it in the second class. Change the category name first- change launcher to DEFAULT. Copy path from second.xml(from text tab : “tools:context”) file to manifest file action tab. Add a button to first Activity. By clicking on it, open second activity.

3 Code Private static Button btn; Btn=(Button)findViewById(R.id.button); Btn.setOnClickListener(new View.OnClickListener(){ Public void onClick(View V) {//Create an object of Intent Intent intent=new Intent(“path”);//from manifest startActivity(intent); } }); } Call the method in onCreate() method.

4


Download ppt "New Activity On Button Click via Intent. App->res->Layout->Blank Activity A new xml file is created and a new class is added to java folder. In manifest.xml."

Similar presentations


Ads by Google