打不开页面,android工作室
can't open the page, android studio
我正在编写一个单独的应用程序。我有一个奇怪的问题。昨天该应用程序还可以,今天当我想转到另一个页面时该应用程序停止了。只停了一页。
这是我在这个页面上的一段代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lebensmittel_start_seite);
infoText = (TextView) findViewById(R.id.leb_info_text);
infoText.setText("Die Kohlenhydratmenge bei abgepackten Lebensmitteln und " +
"Fertigprodukten finden Sie bei den Nährwertangaben. Die KE können " +
"Sie berechnen, indem Sie die Kohlenhydratmenge pro 100 g durch 10 teilen." +
"Beispiel: 100 g Schokolade = 48 g Kohlenhydrate 48 g / 10 = 4,8 KE");
spinner1=(Spinner) findViewById(R.id.spinner);
spinner2=(Spinner) findViewById(R.id.spinner_leb);
ArrayAdapter adapter1= createFromResource(this, R.array.menue_array, android.R.layout.simple_spinner_item);
ArrayAdapter adapter2= createFromResource(this, R.array.Lebensmittel_Liste, android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(adapter1);
spinner2.setAdapter(adapter2);
spinner1.setOnItemSelectedListener(this);
spinner2.setOnItemSelectedListener(this);
}
这是我的 logcat:
09-20 09:39:02.237 2592-2592/com.example.mac.diabetikerhilfe E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mac.diabetikerhilfe, PID: 2592
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.mac.diabetikerhilfe/com.example.mac.diabetikerhilfe.LebensmittelSeiten.Lebensmittel_Start_Seite}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1932)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1615)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:708)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at com.example.mac.diabetikerhilfe.Start.onItemSelected(Start.java:60)
at android.widget.AdapterView.fireOnSelected(AdapterView.java:944)
at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:933)
at android.widget.AdapterView.-wrap1(Unknown Source:0)
at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:898)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
android.content.ActivityNotFoundException: 无法找到明确的 activity class {com.example.mac.diabetikerhilfe/com.example.mac.diabetikerhilfe.LebensmittelSeiten.Lebensmittel_Start_Seite};
AndroidManifest.xml?
在 AndroidManifest.xml
上宣布了您的 Activity
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ActivityName"/>
</applications>
我正在编写一个单独的应用程序。我有一个奇怪的问题。昨天该应用程序还可以,今天当我想转到另一个页面时该应用程序停止了。只停了一页。
这是我在这个页面上的一段代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lebensmittel_start_seite);
infoText = (TextView) findViewById(R.id.leb_info_text);
infoText.setText("Die Kohlenhydratmenge bei abgepackten Lebensmitteln und " +
"Fertigprodukten finden Sie bei den Nährwertangaben. Die KE können " +
"Sie berechnen, indem Sie die Kohlenhydratmenge pro 100 g durch 10 teilen." +
"Beispiel: 100 g Schokolade = 48 g Kohlenhydrate 48 g / 10 = 4,8 KE");
spinner1=(Spinner) findViewById(R.id.spinner);
spinner2=(Spinner) findViewById(R.id.spinner_leb);
ArrayAdapter adapter1= createFromResource(this, R.array.menue_array, android.R.layout.simple_spinner_item);
ArrayAdapter adapter2= createFromResource(this, R.array.Lebensmittel_Liste, android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(adapter1);
spinner2.setAdapter(adapter2);
spinner1.setOnItemSelectedListener(this);
spinner2.setOnItemSelectedListener(this);
}
这是我的 logcat:
09-20 09:39:02.237 2592-2592/com.example.mac.diabetikerhilfe E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mac.diabetikerhilfe, PID: 2592
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.mac.diabetikerhilfe/com.example.mac.diabetikerhilfe.LebensmittelSeiten.Lebensmittel_Start_Seite}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1932)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1615)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:708)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at com.example.mac.diabetikerhilfe.Start.onItemSelected(Start.java:60)
at android.widget.AdapterView.fireOnSelected(AdapterView.java:944)
at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:933)
at android.widget.AdapterView.-wrap1(Unknown Source:0)
at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:898)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
android.content.ActivityNotFoundException: 无法找到明确的 activity class {com.example.mac.diabetikerhilfe/com.example.mac.diabetikerhilfe.LebensmittelSeiten.Lebensmittel_Start_Seite}; AndroidManifest.xml?
在 AndroidManifest.xml
上宣布了您的 Activity <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ActivityName"/>
</applications>