Android Getting Started Summary

1.MainActivity main interface
  R automatically generates
  drawble pictures
  latout page layout
  strings.xml contains fixed strings
  AndroidManifest.xml


2. Click event
(1) Create a class, as above MyListener class.
btnCall.setOnClickListener(new MyListener());
(2) Use anonymous class
btnCall.setOnClickListener(new MyLinstener(){
public void onClick(View v){
doClick();
}
}); 
(3) The third type of click event Method, commonly used in development
btnCall.setOnClickListener(this);
btn??.setOnClickListener(this);
public void onCLick(View v){
switch(v.getId()){
case R.id.btnCall:
doClick();
break ;
}
}
(4) Register in the layout file. It is not recommended to use the value of Toast.LENGTH.SHORT in development; the value of Toast.LENGTH.LONG is 1;
android:onclick="doSth"
public void doSth(View view){
Toash .makeText(this,"I am the method registered in the layout file, I am the toast",Toast.LENGTH.SHORT).show();
}


3. Common commands for
adb adb shell enter


adb install install


ctrl+c clear screen


cls Clear the screen


4. Log
V means long-winded, Log.v(tag, message);


D is debugging information, Log.d(tag, message);


I is info, Log.i(tag, message);


W is warning ,Log.w(tag, message);


E means error, Log.e(tag, message);


V and D are used for debugging,


only I, W, E can be used after publishing


When an ANR/focus close error occurs, if it is a real machine, there will be a log under the /data/log folder

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325829959&siteId=291194637