java.lang.Runtimeexception: Unable to start Activity

Asked

Viewed 198 times

1

My logcat is displaying a pointer error to start the activity Ouvir I can see but I didn’t find the error. Exiting these messages when I run the application:

11-27 22:09:40.631: E/AndroidRuntime(1513): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rs.player/com.rs.player.Ouvir}: java.lang.NullPointerException

Method that calls the Activity through the Intent by means of a MenuItem in the main class MainActivity:

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_1:
                // Esta é a classe que está acusando o erro: 
                Intent intent = new Intent(this, Ouvir.class);
                this.startActivity(intent);
                break;
            default:
                return super.onOptionsItemSelected(item);
        }
        return true;
    }

In the AndroidManifest the activity is being applied:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rs.player"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar"
         >
        <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:theme="@android:style/Theme.Black.NoTitleBar" 
                    android:label="@string/app_name" 
                    android:name=".Ouvir" 
                    android:screenOrientation="portrait" class=".Ouvir" />

    </application>

</manifest>
  • The code breaks when you install Intent?

  • The method onOptionsItemSelected is within an Activity?

  • I decided by changing the name of the method and replacing your javadoc.

  • I am having trouble restarting the audio logcat warns you that you are having trouble saving the buffer to a specific location: 11-28 13:29:44.841: E/com.rs.player.StreamingMediaPlayer(888): Buffered File path: /data/data/com.rs.player/cache/playingMedia0.dat

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.