[英]With the update to Android Studio can't start activity
Android studio has updated and before everything was going ok but now with this update I cant seem to get my next activity after successful login to start, here: Android Studio已更新,在一切正常之前,但是现在有了此更新,成功登录后,我似乎无法进行下一个活动,这里:
public void doLogIn(View v) {
EditText username = (EditText) findViewById(R.id.userEditText);
EditText password = (EditText) findViewById(R.id.passwordditText);
final Intent intent = new Intent(this, Menu.class);
if (username.getText().toString().isEmpty() || password.getText().toString().isEmpty()) {
//Intent intent = new Intent(this, Registro_activity.class);
//intent.putExtra(EXTRA_MESSAGE, change);
Toast.makeText(this, "Necesitas poner tu usuario y la contraseña para acceder.", Toast.LENGTH_LONG).show();
} else {
Log.d("We", "are almost");
ParseUser.logInInBackground(username.getText().toString(), password.getText().toString(), new LogInCallback() {
@Override
public void done(ParseUser user, com.parse.ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
Log.d("IN", "APP");
validLogin(e);
startActivityNew(intent);
} else {
// Signup failed. Look at the ParseException to see what happened.
Log.d("error", e.toString());
invalidLogin(e);
}
}
});
}
}
public void startActivityNew(Intent intent) {
startActivity(intent);
}
And it is declared in AndroidManifest.xml as: 它在AndroidManifest.xml中声明为:
<application
android:name=".StarterApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key" />
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ChangePass"
android:label="@string/title_activity_change_pass" >
</activity>
<activity
android:name=".Menu"
android:label="@string/title_activity_menu"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.parse.starter.MainActivity" />
</activity>
</application>
The error: 错误:
10-19 23:44:58.922 21649-21649/com.parse.starter E/AndroidRuntime: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.parse.starter/android.view.Menu}; have you declared this activity in your AndroidManifest.xml?
What has happened?? 发生了什么事?? Any help?? 有帮助吗?
Try this Manifest 试试这个清单
<application
android:name=".StarterApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.parse.APPLICATION_ID"
android:value="@string/parse_app_id" />
<meta-data
android:name="com.parse.CLIENT_KEY"
android:value="@string/parse_client_key" />
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ChangePass"
android:label="@string/title_activity_change_pass" >
</activity>
<activity
android:name="com.parse.starter.Menu"
android:label="@string/title_activity_menu"
android:parentActivityName="com.parse.starter.MainActivity"
android:theme="@style/AppTheme" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.parse.starter.MainActivity" />
</activity>
</application>
ActivityNotFoundException (YES, this activity is declared in AndroidManifest.xml) ActivityNotFoundException(是的,此活动在AndroidManifest.xml中声明)
Give the Menu.class a more specific location ie the link above, adding the package as a suffix. 给Menu.class一个更特定的位置,即上面的链接,将包添加为后缀。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.