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.