Bugs that Android encounters

Source: Internet
Author: User

1BUG, (SQLite related)

Encountered: Attempt to re-open an already-closed object:sqlitedatabase:/data/data/com.example.biye/databases/todothing.db

Attempt to reopen an object that has been closed: sqlitedatabase ...

Workaround: See if the previous method has closed the database operation?   such as: Db.close (); Comment out or delete it.

2.BUG, (edittext Assignment)

Encounter: EditText Edit31.settext ("Just don't let you assign value");
Research: Error null pointer abnormal nullpointerexception;

Did you have the wrong ID?  1. <edittext android:id= "@+id/edit31"/> 2.    Edit31 = (EditText) Findviewbyid (R.ID.EDIT31); Oh, yes!! Tangled

Find out why: edit31 = (EditText) Findviewbyid (R.ID.EDIT31); Position after the button event, when the BTN event is executed, the program does not assign EditText to edit31 on the UI interface, so edit31 is null.

Solution: Edit31 = (EditText) Findviewbyid (R.ID.EDIT31); Position transferred to Setonclicklistener (); Go above, bug solved. Such as:

3.BUG (SQLite related)

Encounter: Unrecognized token ....  An error in the SQL statement address: db.update ("thing", CV, "thing_name=" + name, null); Name is passed over the argument string type

Research: There is a problem with the SQL statement, name is a character type, and the SQL statement should have a ' single quote '

Resolution: 1.   String[] Str={name}; Db.update ("thing", CV, "thing_name=", str);

2 Db.update ("thing", CV, "thing_name=" "+name+" ' ", null);

4.BUG (SQLite related)

Encountered: notfoundexception:string resource ID #0x4

The study finds out why: Toast.maketext (context, reslut.length, and The). Show (); Reslut.length is of type int, Toast.maketext () requires string type

WORKAROUND: Convert int to string, or after the int value + "" such as: toast.maketext (context, reslut.length+ "", "). Show ();

5.BUG (program does not run)

Encountered: The connection to ADB was down, and a severe error had occured.

Research: ADB connection has been a problem, to Baidu search the next

FIX: Method 1.cmd in adb kill-server, then adb-startserver (I tried, and no egg used)

CMD found in the Platform-tools of your Android SDK:

Method 2. Method 1 doesn't work, kill Adb.exe in Task Manager, and then restart Eclipse. (this to is resolved, do not close the virtual phone case, otherwise can not find Adb.exe)

Continuous accumulation, if there are errors please help to point out, good advice please enlighten, some of the solution is also in the evening search, thank you

Bugs that Android encounters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.