Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:14:39+00:00 2026-06-08T18:14:39+00:00

I know there are many people who have the problem. I’ve tried many ways

  • 0

I know there are many people who have the problem. I’ve tried many ways I can find, however still get the error.

  1. there’s only one activity and it’s registered.
  2. tried to complete .MainActivity by com.hermione.woodenfish.MainActivity, no use
  3. clean and rebuild don’t work either

really need help, thanks!!

LogCat:

08-01 12:09:33.944: E/Trace(1032): error opening trace file: No such file or directory (2)
08-01 12:09:34.384: D/AndroidRuntime(1032): Shutting down VM
08-01 12:09:34.424: W/dalvikvm(1032): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-01 12:09:34.465: E/AndroidRuntime(1032): FATAL EXCEPTION: main
08-01 12:09:34.465: E/AndroidRuntime(1032): java.lang.RuntimeException: Unable to     instantiate activity   ComponentInfo{com.hermione.woodenfish/com.hermione.woodenfish.MainActivity}: java.lang.NullPointerException
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.os.Looper.loop(Looper.java:137)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread.main(ActivityThread.java:4745)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at java.lang.reflect.Method.invoke(Method.java:511)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at dalvik.system.NativeStart.main(Native Method)
08-01 12:09:34.465: E/AndroidRuntime(1032): Caused by: java.lang.NullPointerException
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.content.ContextWrapper.getResources(ContextWrapper.java:81)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.media.MediaPlayer.create(MediaPlayer.java:824)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at com.hermione.woodenfish.MainActivity.<init>(MainActivity.java:24)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at java.lang.Class.newInstanceImpl(Native Method)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at java.lang.Class.newInstance(Class.java:1319)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
08-01 12:09:34.465: E/AndroidRuntime(1032):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
08-01 12:09:34.465: E/AndroidRuntime(1032):     ... 11 more
08-01 12:33:02.784: E/Trace(1171): error opening trace file: No such file or directory (2)
08-01 12:33:03.125: D/AndroidRuntime(1171): Shutting down VM
08-01 12:33:03.125: W/dalvikvm(1171): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-01 12:33:03.154: E/AndroidRuntime(1171): FATAL EXCEPTION: main
08-01 12:33:03.154: E/AndroidRuntime(1171): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hermione.woodenfish/com.hermione.woodenfish.MainActivity}: java.lang.NullPointerException
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.os.Looper.loop(Looper.java:137)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread.main(ActivityThread.java:4745)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at java.lang.reflect.Method.invoke(Method.java:511)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at dalvik.system.NativeStart.main(Native Method)
08-01 12:33:03.154: E/AndroidRuntime(1171): Caused by: java.lang.NullPointerException
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.content.ContextWrapper.getResources(ContextWrapper.java:81)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.media.MediaPlayer.create(MediaPlayer.java:824)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at com.hermione.woodenfish.MainActivity.<init>(MainActivity.java:23)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at java.lang.Class.newInstanceImpl(Native Method)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at java.lang.Class.newInstance(Class.java:1319)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
08-01 12:33:03.154: E/AndroidRuntime(1171):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
08-01 12:33:03.154: E/AndroidRuntime(1171):     ... 11 more

MainActivity.java

package com.hermione.woodenfish;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    private MediaPlayer mp = MediaPlayer.create(this, R.raw.knok);
    public void sendKnok(View view) {
        if (mp.isPlaying()){
            mp.stop();
        }
        mp.start();
    }
}

Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hermione.woodenfish"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:14:41+00:00Added an answer on June 8, 2026 at 6:14 pm

    I think the problem is here in this line,

     private MediaPlayer mp = MediaPlayer.create(this, R.raw.knok);
    

    You have tried to initialize the Context object before the onCreate(). This might be creating the problem. How about you Initialize your MediaPlayer inside your onCreate(),

    private MediaPlayer mp =null;  //Global Declaration
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        mp = MediaPlayer.create(this, R.raw.knok);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there have been many people asking the same thing, I have read
I know there are many tutorials out there for getting started in C. However
NOTE: I know there are many questions that talked about that but I'm still
First off, I know there are many different easier/reliable ways to perform what I
I know there have been many questions on grid and pack in the past
I know many people who use computers every day, who do not know how
I know there are many discussions about the emulator which is so slow that
I know there are many cases which are good cases to use multi-thread in
I know there are many database design tool, database modeling tool. Example, ER-win ,
I know there are many tutorials to use Dropbox as a Git repository, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.