Android Development Notes (iii)

Source: Internet
Author: User

The Popup popup box was created in OnCreate when the exception

Unable to add window-token null was not valid; Is your activity running? Errors and how to modify them

Popup popup is to rely on a parent window or parent View, the root cause of this error is that the parent window has not been created when the call to the popup box caused the failure.

Instead, it can be resolved by invoking it in Onattachedtowindow.

Two

The difference between import static and import

Import static import is a new feature in JDK1.5. Generally we import a class with import com ..... ClassName, while static import is this: import static com ..... Classname.*, there is more static here, there is a class name ClassName behind more. *, which means to import static methods in this class. Of course, you can just import a static method, just change the. * to a static method name. Then in this class, you can call the static method directly with the method name, rather than using the ClassName. Method name.
The advantage of this approach is that it simplifies some operations, such as printing operations System.out.println (...); You can write it to a static method, print (...), and print (...) directly when you use it. You can do it.
But this method is recommended to use when there are a lot of repeated calls, if only one to two calls, it is better to write directly to the convenience

Android Development Notes (iii)

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.