登録フォームを開始するとすぐにダイアログボックスとして表示する必要があるアクティビティを作成しています。ただし、アクティビティは常にクラッシュします。 次の活動のためのコードである:ここでAndroidのダイアログボックスがクラッシュするApp
public class CheckInActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check_in);
getDialogue();
}
public void getDialogue(){
//Pop dialogue
AlertDialog.Builder mBuilder= new AlertDialog.Builder(getApplicationContext());
View mView= getLayoutInflater().inflate(R.layout.dialog_register, null);
final EditText mPhone= (EditText) mView.findViewById(R.id.etPhone);
final EditText mPass= (EditText) mView.findViewById(R.id.etPass);
final EditText mRtPass= (EditText) mView.findViewById(R.id.etRtPass);
Button mRegisterButton = (Button) mView.findViewById(R.id.btnRegister);
mBuilder.setView(mView);
AlertDialog dialog= mBuilder.create();
dialog.show();
}
}
はactivity_check_in.xmlファイルです:ここで
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.shashank_pc.trial.CheckInActivity">
</android.support.constraint.ConstraintLayout>
活動がandroid_manifest.xmlファイルである
<activity android:name=".CheckInActivity"
android:theme="@style/Theme.AppCompat">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
エラーメッセージは次のとおりです。
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
助けてください!
これは質問に対する答えを提供しません。批評をしたり、著者の説明を求めるには、投稿の下にコメントを残してください。 - [レビューの投稿](レビュー/低品質の投稿/ 17255671) – FluffyKitten