Today, will be "the first line of code," the final Combat Coolweather project, carefully done it again.
Tonight, in the first phase of the book to develop code in the end of the Android studio, found that the Setonitemclicklistener function according to the book error, the original book as follows:
However, error, Gradel hint that the class does not exist, it is unclear whether because the author version is too old reason, to be verified, later, I used the following method, compiled through, as follows:
In fact, I just called the Adapterview inside the Onitemclicklistener method.
In addition, I found a problem, that is, I gradel through the data line connected to the Android phone, debugging, the software can be installed normally, the first page, the national list of provinces can also be displayed normally, but in my click on a province, the normal should appear in the province of the city list, but then, the system crashes, App Flashback, see the error message, shown as follows:
Here, I realized that there is a problem with the SQL statement, sure enough, in the establishment of the city table, province_id error written province_code, I changed!!!
The problem came, changed, re-Gradel, restart the app, still can't solve the problem, or the same error, let me spend one hours, re-check is not where the error, also online check, strackoverflow answer all tell me, is the SQL statement is wrong, Then I tried to completely delete the original version of the app, then install, run, success.
Android Development Learning process "the first line of code" Coolweather Project Setonitemclicklistener function, SQL statement modification to simulate app program impact