Error: Found text "" Where item tag is expected
If you create a file by yourself, write <string name = "key"> value </string> and copy the file to strings. XML, or copy and paste from other documents, the above question may appear, very disgusting
This error is caused by incorrect space format.
Solution:
1. Copy the <string name = "key"> value </string> tag in the eclipse editor and enter value in it.
2. Delete spaces. After the copy, press the delete key of each row to return to the end of the previous row, press enter to make it automatically, and then delete invalid spaces.
The following solutions are also available on the Internet. To solve this problem, we recommend that you: 1. Check whether unnecessary spaces exist and delete them if any. If not, copy and paste the document again. Try not to use different document formats. If not, then 3; 3. replace all the whitespace in the XML document with the space you manually typed out. If not, 4; 4. manually edit it again. For this type of errors, you can use MS Word or Excel to call the document to see if the space format is incorrect.
Note: similar errors (empty lattice errors in XML documents) will also appear in R. Java in the gen folder.
Syntax Error on tokens, delete these tokens
. The above method can solve this problem.Activity has leaked window that was originally addedScenario: when processing time-consuming operations in an application, such as network operations, the thread + handler or asynctask provided by Android is used to improve the user experience, generally, the display progress is customized for dialog or progressdialog. This exception often occurs in this scenario: a foreigner's explanation: views have a reference to their parent context (taken from constructor argument ). if you leave an activity without destroying dialogs and other dynamically created views, they still hold this reference to your activity (if you createdthis
As context: Likenew ProgressDialog(this)
), So it cannot be collected by the GC, causing a memory leak. the main reason is that there is a window handle leakage. When the activity is destroyed, a phonewindow (DIALOG) view does not destroy the reference of the context in which it belongs (obtained through the parameters of the constructor ), when you exit the activity, the dynamically created view (such as dialog) is not closed, and it will always have context references, so it cannot be recycled by GC, resulting in Memory leakage. It is easy to understand the cause, and we can release resources in the ondestroy () method of activity. The following is my solution in this case, and other controls are similar. Solution:
@ Override
Protected void ondestroy (){
If (refreshpd! = NULL)
{
Refreshpd. Dismiss ();
}
Super. ondestroy ();
}