Download presentation
Presentation is loading. Please wait.
Published byBritney Skinner Modified over 9 years ago
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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.