New Activity on Button Click
Step1:Class extend as follows:
class Activity1 extends Activity implements OnClickListener {
public
Activity
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with
Step2: Define button with in the class as:
Button b1=(Button) findViewById(R.id.button2);
b1.setOnClickListener(this);
Step3: Add intent to onclick:
onClick(View v) {
Intent i=new Intent(this,Activity2.class);
startActivity(i);
Intent
Intent obj=new Intent(this,second_page_activity.class);
Step4: When we define new activity, we have to mention in the Manifest.xml
<activity
android:name=".secondactivity"
/>
Click HERE..!
Step1:Class extend as follows:
class Activity1 extends Activity implements OnClickListener {
public
Activity
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with
setContentView(View)
. While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with windowIsFloating
set) or embedded inside of another activity (using ActivityGroup
). Step2: Define button with in the class as:
Button b1=(Button) findViewById(R.id.button2);
b1.setOnClickListener(this);
Step3: Add intent to onclick:
onClick(View v) {
Intent i=new Intent(this,Activity2.class);
startActivity(i);
Intent
Intent obj=new Intent(this,second_page_activity.class);
Step4: When we define new activity, we have to mention in the Manifest.xml
<activity
android:name=".secondactivity"
/>
Click HERE..!
No comments :
Post a Comment