In the app , an activity usually refers to a separate screen, which is a Web page within a Web site that is visible to the user, can display some controls on it, and can listen for the time it takes to process the user to respond.
so How do you communicate between the activity? They are communicating through intent and switching. Intent has two important parts (motion transfer, data transfer);
? God Horse is Activity?
Activity is a four-component, representative user-accessible interface that can interact with users. For example, photos, login registration and other interactive interface. An application typically consists of multiple activity loosely coupled (low-coupling), when the user opens the app to see the first interface we call mianactivity. An activity can start another activity, and when the new activity starts, the previous activity will stop, However, the system saves it to the background stack (backstack)and gets the user focus. the back stack follows the principle of last-in, first-out, and when the user presses the return key, the current activity is removed from the Backstack and the previous one is restored.
Activity callback function: Create, start, resume, pause, stop, destroy;
binding Views: Setcontentview(view)
Communication between Activity through intent .
Intent Intent = new Intent (mainactivity.this,orther.class);
StartActivity (Intent);
? MVC Pattern:
M (Model ):model is the main part of the application, and all business logic should be written here, in the Android model layer and Java EE is not a small change, such as: the operation of the database, the operation of the network, etc. are placed in the layer (but not that they are placed in the same package, can be divided into open, but they collectively referred to as the Model layer).
V(view view): Is the part of the application that is responsible for generating the user interface and the only layer that the user can see in the entire MVC architecture, receiving user input, displaying processing results; on Android The application generally uses the XML file in the German interface description, the use of the time can be very convenient to introduce, of course, can also use javascript+html and other methods as a View.
C(Controller control layer)The task of Android's control layer will fall on the shoulders of many activity , so it is necessary to advise you not to do the activity write too much code, as far as possible to the activity delivery Model business Logic layer processing.
? How do I apply styles and themes to an activity?
by default, an activity occupies the entire screen. We can also customize the Activity to bedisplayed as a window to remind wing FAI to perform certain operations. In this case, it is a good idea to display activity as a dialog box to draw the user's attention.
Modify Add the Android:theme property to the <Activity/> tag in the Androidmanifest.xml file .
Example:<activity
Android:theme= "@android: Style/theme.dialog"
Android:name= "Com.example.helloandroid.MainActivity"
Android:label= "@string/app_name" ></activity >
? Hidden Activity title (ActionBar)
Method One:
Declaring before binding a view in code
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Requestwindowfeature (window.feature_no_title);// hide the title bar, written before binding /// View
Setcontentview (R.layout.activity_main);
binding the View layer
Initwithview ();
Intent Intent = new Intent ();
StartActivity (Intent);
}
Method Two :
in the in the Androidmanifest file:
<activity android:name= ". Activity "
Android:theme= "@android: Style/theme.notitlebar"
></activity>
I believe you have a preliminary understanding of the activity!!! My more popular APP online test tool:www.ineice.com
An explanation of the activity of Android Development (SUMZOM)