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 4233706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:15:17+00:00 2026-05-21T02:15:17+00:00

My app has given me 5 different errors on the market and i can’t

  • 0

My app has given me 5 different errors on the market and i can’t figure it out. It force closes on button click.

This is the first error i was getting.

java.lang.NullPointerException
at com.yes.hotrod.main$1.onClick(main.java:25)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8818)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
at dalvik.system.NativeStart.main(Native Method)

here is my main.java

package com.yes.hotrod;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class main extends Activity {MediaPlayer FilmSound;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button button1 = (Button)findViewById(R.id.button1);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.animalkingdom);
    button1.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.animalkingdom);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.animalkingdom); 
    FilmSound.start(); }    
    }});


    Button button2 = (Button)findViewById(R.id.button2);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.bigassstunt);
    button2.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.bigassstunt);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.bigassstunt); 
    FilmSound.start(); }    
    }
    });
    Button button3 = (Button)findViewById(R.id.button3);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.godsofwar);
    button3.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.godsofwar);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.godsofwar); 
    FilmSound.start(); }    
    }
    });
    Button button4 = (Button)findViewById(R.id.button4);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.greentea);
    button4.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.greentea);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.greentea); 
    FilmSound.start(); }    
    }
    });
    Button button11 = (Button)findViewById(R.id.button11);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.havefun);
    button11.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.havefun);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.havefun); 
    FilmSound.start(); }    
    }
    });
    Button button6 = (Button)findViewById(R.id.button6);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.kisswashot);
    button6.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.kisswashot);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.kisswashot); 
    FilmSound.start(); }    
    }
    });
    Button button7 = (Button)findViewById(R.id.button7);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.ohshit);
    button7.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.ohshit);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.ohshit); 
    FilmSound.start(); }    
    }
    });
    Button button8 = (Button)findViewById(R.id.button8);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.throwingstar);
    button8.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.throwingstar);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.throwingstar); 
    FilmSound.start(); }    
    }
    });
    Button button9 = (Button)findViewById(R.id.button9);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.twolegittwoquit);
    button9.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.twolegittwoquit);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.twolegittwoquit); 
    FilmSound.start(); }    
    }
    });
    Button button10 = (Button)findViewById(R.id.button10);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.whiskey);
    button10.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.whiskey);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.whiskey); 
    FilmSound.start(); }    
    }
    });
    Button button5 = (Button)findViewById(R.id.button5);
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.demons);
    button5.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
    if (FilmSound.isPlaying()) 
    {
    FilmSound.stop();
    FilmSound.reset();
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.demons);
    FilmSound.start();
    }
    else {
    FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.demons); 
    FilmSound.start(); }    
    }
    });
}
}
  • 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-21T02:15:17+00:00Added an answer on May 21, 2026 at 2:15 am

    If you look at the stack trace you will see that the error is occurring on line 25 of main.java, inside the onClick method for the OnClickListener for button1.

    Most likely something went wrong when you were trying to instantiate the FilmSound object and it is null inside that method.

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

Sidebar

Related Questions

Given an app (your app) and a certain action it has, is it possible
My app has several buttons which trigger different events. The user should NOT be
My app has some table cells that vary in height. The cells can also
I've been given the ask of converting an MVP ASP.NET app to Silverlight. This
In my android app I have a login screen. A graphic designer has given
I have 2 Controllers within one app as I am trying out these different
My app has a session timeout after 30 minutes. If the user has a
My app has three text fields: 1) Username // Initialization code usernameTextField = [[UITextField
My app has 6 menu items, so the OS shows the first 4, then
My app has to load an image from a http server and displaying it

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.