Error on Android Studio development "unfortunately, xxx has stopped" the

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_41934745/article/details/92126473

In Android Studio developers, you may encounter such a situation: When code hints without any error messages, but running virtual machine, click a button to operate, may appear "unfortunately, xxx has stopped" ( xxx is project name) error. This is in fact the presence of a logic error in the code hints, not the software can detect and find the symbol, this time we should be careful to check the contents of the control code to trigger the prompt.
Individuals in the face of this situation, is in the production of accounting App, add a database, the database only declare "private DataBaseHelper dataBaseHelper;", without calling its constructor "dataBaseHelper = new DataBaseHelper (this) ;" results.
When there is the use of the database cursor to the variable assignment, position the cursor beyond the scope of the database table the results of property. The time of only five attributes, position marker assigned to the integer t is the text string 5 "int t = Integer.parseInt (cursor.getString ( 5));", and the cursor is counted from 0, only to give 4, marked by a string.

Guess you like

Origin blog.csdn.net/qq_41934745/article/details/92126473