Android: couldn't save which view has focus because the focused view ### has no ID

Source: Internet
Author: User

Problem:

Android: couldn't save which view has focus because the focused view ### has no ID

There are two possible causes:

Solution 1:

<Application

Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name">

<Activity

Android: Label = "@ string/app_name"

Android: configchanges ="Orientation | keyboardhidden | keyboard | screenlayout"

Android: Name = ". Main">

<Intent-filter>

<Action Android: Name = "android. Intent. Action. Main"/>

<Category Android: Name = "android. Intent. Category. launcher"/>

</Intent-filter>

</Activity>

</Application>

Solution 2:

What probably happened is that you created a thread in the surfacecreated () method but didn't stop it or get rid of it in the surfacedestroy () method.

When you didn't give a theme for the preferences, it took over the whole screen and your old surface was destroyed. but when you specified a dialog-like theme, the old surface was still there because it was visible underneath the preferences.

Public void surfacecreated (surfaceholder holder)
{
If (_ thread = NULL| _ Thread. getstate () = thread. state. Terminated)
{
_ Thread = new tutorialthread (getholder (), this );
_ Thread. setrunning (true );
_ Thread. Start ();
}
Else
{
_ Thread. setrunning (true );
_ Thread. Start ();
}
}

This solved the problem for me, a thread's start method cannot be called twice, so I had to reallocate...

Http://forums.pragprog.com/forums/138/topics/4085

Related Article

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.