Solutions to some common errors in Android development from eclipse to Android Studio: eclipseandroid

Source: Internet
Author: User

Solutions to some common errors in Android development from eclipse to Android Studio: eclipseandroid

1. added a Dialog topic to an Activity. The following error occurs, but no error occurs in eclipse.

 <activity            android:name=".DialogActivity"            android:label="@string/title_activity_dialog"            android:theme="@android:style/Theme.Dialog"            >        </activity>

Error message:

Java. lang. IllegalStateException: You need to use a Theme. AppCompat theme (or descendant) with this activity.

2. Add requestWindowFeature (Window. FEATURE_NO_TITLE) to the Activity. (No title is displayed.) No error is reported in eclipse, but an error is reported in android studio.

1     @Override2     protected void onCreate(Bundle savedInstanceState) {3         super.onCreate(savedInstanceState);4          requestWindowFeature(Window.FEATURE_NO_TITLE);5         setContentView(R.layout.activity_dialog);6     }

 

 

Solution:

The activity created by Android Studio is MainActivity extends ActionBarActivity. Change ActionBarActivity to Activity and export the package.

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.