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

  • Home
  • SEARCH
  • 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 6178015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:23:45+00:00 2026-05-24T00:23:45+00:00

I want to create a soundboard, so when you click on button it plays

  • 0

I want to create a soundboard, so when you click on button it plays the sound.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.akali);

    Button b = (Button) findViewById(R.id.akaliJokeButton);
    b.setOnClickListener(new OnClickListener() {


        public void onClick(View v) {
            MediaPlayer mp = MediaPlayer.create(Akali.this, R.raw.akalijoke);
            mp.start();
        }
    });

}

That is my code that I have so far. But I get a no pointer exception error

07-25 14:36:47.919: DEBUG/AndroidRuntime(1079): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-25 14:36:47.919: DEBUG/AndroidRuntime(1079): CheckJNI is ON
07-25 14:36:48.529: DEBUG/AndroidRuntime(1079): Calling main entry com.android.commands.pm.Pm
07-25 14:36:48.560: DEBUG/AndroidRuntime(1079): Shutting down VM
07-25 14:36:48.569: DEBUG/dalvikvm(1079): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
07-25 14:36:48.579: DEBUG/dalvikvm(1079): Debugger has detached; object registry had 1 entries
07-25 14:36:48.599: INFO/dalvikvm(1079): JNI: AttachCurrentThread (from ???.???)
07-25 14:36:48.599: INFO/AndroidRuntime(1079): NOTE: attach of thread 'Binder Thread #3' failed
07-25 14:36:48.989: DEBUG/AndroidRuntime(1089): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-25 14:36:48.989: DEBUG/AndroidRuntime(1089): CheckJNI is ON
07-25 14:36:49.579: DEBUG/AndroidRuntime(1089): Calling main entry com.android.commands.am.Am
07-25 14:36:49.609: INFO/ActivityManager(61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.reg.lolsoundboard/.Main } from pid 1089
07-25 14:36:49.829: DEBUG/AndroidRuntime(1089): Shutting down VM
07-25 14:36:49.849: DEBUG/dalvikvm(1089): GC_CONCURRENT freed 102K, 69% free 320K/1024K, external 0K/0K, paused 1ms+1ms
07-25 14:36:49.849: DEBUG/jdwp(1089): Got wake-up signal, bailing out of select
07-25 14:36:49.849: DEBUG/dalvikvm(1089): Debugger has detached; object registry had 1 entries
07-25 14:36:49.879: INFO/ActivityManager(61): Start proc com.reg.lolsoundboard for activity com.reg.lolsoundboard/.Main: pid=1099 uid=10036 gids={}
07-25 14:36:49.931: INFO/AndroidRuntime(1089): NOTE: attach of thread 'Binder Thread #3' failed
07-25 14:36:50.839: DEBUG/dalvikvm(1099): GC_EXTERNAL_ALLOC freed 49K, 53% free 2557K/5379K, external 2002K/2137K, paused 54ms
07-25 14:36:51.250: INFO/ActivityManager(61): Displayed com.reg.lolsoundboard/.Main: +1s426ms (total +8m29s588ms)
07-25 14:36:52.179: INFO/ActivityManager(61): Starting: Intent { cmp=com.reg.lolsoundboard/.Akali } from pid 1099
07-25 14:36:52.299: DEBUG/AndroidRuntime(1099): Shutting down VM
07-25 14:36:52.299: WARN/dalvikvm(1099): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099): FATAL EXCEPTION: main
07-25 14:36:52.309: ERROR/AndroidRuntime(1099): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.reg.lolsoundboard/com.reg.lolsoundboard.Akali}: java.lang.NullPointerException
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.os.Looper.loop(Looper.java:123)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread.main(ActivityThread.java:3683)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at java.lang.reflect.Method.invokeNative(Native Method)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at java.lang.reflect.Method.invoke(Method.java:507)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at dalvik.system.NativeStart.main(Native Method)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099): Caused by: java.lang.NullPointerException
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at com.reg.lolsoundboard.Akali.onCreate(Akali.java:19)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-25 14:36:52.309: ERROR/AndroidRuntime(1099):     ... 11 more
07-25 14:36:52.319: WARN/ActivityManager(61):   Force finishing activity com.reg.lolsoundboard/.Akali
07-25 14:36:52.329: WARN/ActivityManager(61):   Force finishing activity com.reg.lolsoundboard/.Main
07-25 14:36:52.839: WARN/ActivityManager(61): Activity pause timeout for HistoryRecord{406fa098 com.reg.lolsoundboard/.Akali}
07-25 14:36:54.199: INFO/Process(1099): Sending signal. PID: 1099 SIG: 9
07-25 14:36:54.209: INFO/ActivityManager(61): Process com.reg.lolsoundboard (pid 1099) has died.
07-25 14:36:54.209: INFO/WindowManager(61): WIN DEATH: Window{40761880 com.reg.lolsoundboard/com.reg.lolsoundboard.Main paused=true}
07-25 14:36:54.299: WARN/InputManagerService(61): Got RemoteException sending setActive(false) notification to pid 1099 uid 10036

XML File

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/akalibg" android:weightSum="1">
        <RelativeLayout android:layout_width="match_parent" android:id="@+id/relativeLayout1" android:layout_height="wrap_content" android:layout_weight="0.33">

            <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:id="@+id/akaliLaugh1" android:text="Laugh 1"></Button>
            <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:text="Laugh 2" android:id="@+id/akaliLaugh2"></Button>
            <Button android:text="Laugh 3" android:id="@+id/akaliLaugh3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignTop="@+id/akaliLaugh4" android:layout_alignLeft="@+id/akaliJokeButton"></Button>
            <Button android:id="@+id/akaliLaugh4" android:layout_height="wrap_content" android:keepScreenOn="false" android:layout_width="wrap_content" android:layout_centerVertical="true" android:layout_alignLeft="@+id/akaliLaugh1" android:text="Laugh 4"></Button>
            <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignBottom="@+id/akaliLaugh4" android:layout_alignParentRight="true" android:id="@+id/akaliTaunt" android:layout_alignLeft="@+id/akaliLaugh2" android:text="Taunt 1"></Button>
            <Button android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignRight="@+id/akaliLaugh3" android:text="Joke 1"></Button>

            </RelativeLayout>
        <RelativeLayout android:layout_width="match_parent" android:id="@+id/relativeLayout2" android:layout_height="wrap_content">
        </RelativeLayout>


    </LinearLayout>

Initial Home screen to get to the actual soundboard

package com.reg.lolsoundboard;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;


public class Main extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);


       ImageButton b = (ImageButton) findViewById(R.id.akaliButton);
       b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            startActivity(new Intent(Main.this, Akali.class));

        }
    });
    }
}
  • 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-05-24T00:23:46+00:00Added an answer on May 24, 2026 at 12:23 am

    You don’t seem to have a button with the id “akaliJokeButton”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create an application with animate button? how can i do? after click
I want create a button option that takes the entire datalist and converts it
i want create one simple windows form ,it just contain Editcontrol(textbox),Static Edit(label),Button (Name of
I want create a UIImageView with a button press. I did this with: -
I want create some simple animation for my program. There is 4 invisible button,
i want create multiple search where statement $where_search is a multiple condition from post
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I want create a excel with Apache POI in java and I must insert

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.