Activities are application components that provides a screen to which a user may respond. Its similar to a form in windows programming.
Create a new layout xml file in the layout directory and design the ui as required. Then, add a class with Activity as super class.
In the main activity on the button click method (or anywhere you want), all you need to do is create an Intent and startActivity() as shown ::
and in the activity class
Now you need to include the activity in the manifest file as ::
that's it. :)
Create a new layout xml file in the layout directory and design the ui as required. Then, add a class with Activity as super class.
In the main activity on the button click method (or anywhere you want), all you need to do is create an Intent and startActivity() as shown ::
public void fun(View view){
Intent intent=new Intent(this,newactivity.class);
startActivity(intent);
}
and in the activity class
public class newactivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.newactivity);
}
}
Now you need to include the activity in the manifest file as ::
<activityandroid:name=".newactivity"></activity>
that's it. :)
No comments:
Post a Comment