Suddenly report an error. After careful examination of the code, I found that I forgot the first sentence
public static final String TAG="MainActivity";
In general, when developing a program, you will add a log in the method you write or in the position you are not sure about, so that you can accurately find the error point when running the program,
The general format is log. V (tag, “the name you want to remark”);
Log. E or log. V or log. D or log. I
The main activity is the file name