First quarter 1-8 Notes
/////////////////////
Hump Naming method
The big Hump method capitalizes the first letter of the initial word. Commonly used for class names, function names, properties, namespaces
Variable is usually identified by a small hump method
Four components:
1. Activity Program Interface
2, Intent transfer data
3. Service Background operation
4. Content Provider provide data
The Java environment is set up, the tools directory inside the SDK is added to the environment variable path
src source file;
Gen file, ADT Help generated, there is an R file inside;
Android x.x provides the jar file, the referenced class comes from this;
Asset,res all the resources files, res placed files in the R file generated correlation ID, and asset will not;
HDPI High resolution LDPI low resolution MDPI resolution;
layout file; Values place a string file;
Android manifest configuration file, register activity and so on;
Activity
An activity is a class that inherits activity, requires a replication OnCreate method, needs to be registered in the Manifes, and ". Name" means
Activity and layout file binding Setconteneview;
Layout file ID will be displayed inside the R.java file.
Layout inside the ID set @+id/name;
Fill_parent (match_parent) and the same width as the parent space; Wrap_content is the same height as the content;
Intent the simplest pass, jump;
Inttent consists of 6 information
1. Component Name launch target activity
2. Action done by action
3. How data is transmitted
4, catagory ()
5, Extras key value pair
6. Flags ()
Jump:
Intent A = new Intent ();
A.setclass (Activity.this,otheractivity.class);
StartActivity (A);
Passing Data
Intent Intent = new Intent ();
Intent.putextra ("One", Factorone);
Intent.putextra ("Both", factortwo);
Intent.setclass (Mainactivity.this, Otheractivity.class);
StartActivity (Intent);
Receive data
Intent k = Getintent ();
String Factorone = K.getstringextra ("one");
String factortwo = K.getstringextra ("a");
Activity life cycle
OnCreate ()
OnStart ()
Onrestart ()
Onresume ()
OnPause ()
OnStop ()
OnDestroy ()
A startup program will appear OnCreate (), OnStart (), Onresume ()
When the other activty is started, the OnPause () is executed,
Then there are two cases: one: If the current is all overwritten and not visible, execute OnStop ().
Reopen this interface, execute Onrestart (), OnStart (), Onresume ()
The second is: The current interface is not overwritten, only execute OnPause (), back to this interface is Onresume ().
OnDestroy () Two cases will be executed, one is to explicitly call the Finsh method, and the other is insufficient system resources;
Logcat Commissioning
Flitername is the name of the tag
Log tag is the filtered information
Activity and Task
The Finsh method is written in the OnClick method.
dialog box writing: In the manifest inside modify.
Android:theme= "@android: Style/theme.dialog
Mars Android Note 1