This is a very simple problem, but every time it is used, it will always be a bit messy. Here we record the steps of Logcat:
1. Declare the tag variable in the Activity (the name is actually casual, as follows:
Private static final String tag = "yan ";
2. When you need to use logcat to output information:
Log. I (tag, "screen width:" + display. getWidth () + "screen height:" + display. getHeight ());
3. Double-click Logcat and click "+ ".
Add a new logcat filter, Total
ThreeInformation needs to be written. Logcat Filter corresponds to Log. i, by Log Tag corresponds to yan (tag content, corresponds to the above), by Log Level select info (this is the above Log. i, I represents the meaning of info ). As follows:
Then you can debug the program by printing the information! IfLogcatNot Enabled. ClickWindow --- show view ---- other -- android --- Logcat.
Note: If you still cannot see the logcat information after the preceding steps, sometimes it is because verbose Or info in the figure is not selected (that is, it corresponds to verbose in the figure above ).