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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:29:43+00:00 2026-06-13T21:29:43+00:00

I have an application that should load sound from sd card and then play

  • 0

I have an application that should load sound from sd card and then play it by clicking the button. When I click the button i get those messages in LogCat : Unable to create external files directory , SoundPool error loading /sound1.mp3 , sample 0 not READY
And this is my code :

import java.io.File;

import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {
SoundPool sp;
int mSoundId;
int mStreamId = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        sp = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
        String path = getFullFilePath(getApplicationContext(), "sound1.mp3");
        mSoundId = sp.load(path, 1);

    }
    private String getFullFilePath(Context context, String filename) {  
        File directory = context.getExternalFilesDir(null);
        File file = new File(directory, filename);
        if (!file.canRead()) {
            // error handling
        }
        return file.getAbsolutePath();  
    }

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


        if (mStreamId != 0) {
            sp.stop(mStreamId);
        }
        mStreamId = sp.play(mSoundId, 1, 1, 1, 0, 1f);
    }
}

My LogCat errors :

11-04 18:56:34.499: D/dalvikvm(6547): GC_EXTERNAL_ALLOC freed 46K, 51% free 2686K/5379K, external 0K/0K, paused 57ms
11-04 18:56:34.539: W/ApplicationContext(6547): Unable to create external files directory
11-04 18:58:02.129: E/SoundPool(6644): error loading /sound1.mp3

Adding WRITE_EXTERNAL_STORAGE Premission gives this error :

11-04 19:58:01.729: E/SoundPool(8022): error loading /mnt/sdcard/Android/data/com.example.idea/files/sound1.mp3
  • 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-13T21:29:45+00:00Added an answer on June 13, 2026 at 9:29 pm

    With this error:

    11-04 19:58:01.729: E/SoundPool(8022): error loading /mnt/sdcard/Android/data/com.example.idea/files/sound1.mp3
    

    You stated:

    File exists and it is in /mnt/sdcard/ folder. Application should search external storage for sound1.mp3 and load it if it exists.

    However, /mnt/sdcard/ is not /mnt/sdcard/Android/data/com.example.idea/files/ simply move your sound1.mp3 file to your applications default sdcard folder and SoundPool will be able to load it.

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

Sidebar

Related Questions

I have a web application that uses jQuery to load some sound effect on
i have this android application that requires to load data from a remote server
I have a console application that should do best effort logging to a database
i have the task to build an artifact of an application that should be
I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've
In my iOS application I have made a form that should submit data into
I have been tasked to develop an application for my school that should be
I'm creating an intranet asp.net mvc application that everyone in the company should have
I have created an SMS application in .NET. I wanted that the application should
I have an application that extracts data from some xml that is stored in

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.