Pedro.Alonso
Pedro.Alonso

Reputation: 1005

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:

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:

<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??

Upvotes: 2

Views: 787

Answers (2)

albertoiNET
albertoiNET

Reputation: 1348

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>

Upvotes: 1

hipkiss
hipkiss

Reputation: 197

ActivityNotFoundException (YES, this activity is declared in AndroidManifest.xml)

Give the Menu.class a more specific location i.e. the link above, adding the package as a suffix.

Upvotes: 1

Related Questions