The life cycle of activity: I don't have a detailed record.
Understanding activity:
Activity components:
Setcontentview set the activity's view to show activity:
Here we comment out the Setcontentview code, and we can see that the interface inside the genymotion becomes blank.
Press F4 here
You can jump to the called R layout file.
Here we try to use our own defined layout file to display:
We define two buttons in the layout of our own definition:
The effect is like this:
We can experiment by calling our layout in mainactivity:
So here we can see the effect:
At the same time we can also be configured in the Androidmanifest file:
To start our custom activity:
?
Start a new activity for us to jump,
。
This is another aty.
In the main interface we call this code to set the listener event for the button.
findviewbyid (R.id. butstartanotheractivity ). Setonclicklistener ( Span style= "COLOR: #cc7832" >new view.onclicklistener () {
@Override
public void Onclick (View v) {
StartActivity (new intent (Mainactivity. This,anotheraty. Class }
}) ;
} /span>
So we move the button-pressing event to another Aty
You can see that we are successful and return to the original activity when the click returns.
To start a page:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com")));
Use this method to start a page (the default browser is called and automatically returns to the previous page when the page is closed):
Here's a successful jump back.
In the list of recent applications, we can see that we have called the default browser to implement this function.
So, to the end of this, I will continue to update the ~ new Blogger Master all progress together Oh, Sina Weibo: Hong Evil
?
Android Studio and genymotion Android start from scratch-1