×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    3

    How to read the stored audio files from memory card?

    Hi friends,
    Im doing audio related j2me project. In my project, i have to play the audio stored in memory card. For that i got suggestions to use FileConnection from our friends in this forum. As im new to J2me, i dont know how to use FileConnection..Im having the following doubts:

    1. How can i find out the URL for the audio stored in memory card(My mobile phone is Nokia 5300, series 40, contain 1GB memory card)...?

    2. Also if i use emulator(wireless toolkit 2.5), Where should i store the audio files and What is the URL should i use to read the audio file?

    Im doing another project, I have to read the data present in the notepad(Which is saved in PC's desktop). For that also should i use FileConnection API? Please do help me by providing suitable examples and also source code...

  2. #2
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    307

    Re: How to read the stored audio files from memory card?

    The URL to a file depends on where your are running your demo: emulator or a real phone.

    If you run demo on a PC with the WTK, then you must store the audio file (let's say, "test.wav") into the WTK directory. More specifically, you must put file into the "C:\...bla-bla-bla...\WTK25\appdb\DefaultColorPhone\filesystem\" directory (in "filesystem" directory you may create any other directories as well). In such case your emulator will understand the "/test.wav" part of the URL.

    Now about the "file:///" part. If you want to run demo on a PC with the WTK, then try the following URL: "file://localhost/test.wav". For the real Nokia mobile phone the URL should be "file:///c:/test.wav" (if the file is on the mobile phone's internal memory) or "file:///e:/test.wav" (if file is on the memory card).

    Just a tip to help you to make less work: check whenever you are on emulator or on a real phone, and change the beginning parts in the URLs.


    Code:
    String demoFileLocation = "test.wav";
    String emulatorFilePath = "file://localhost/other/"; // for WTK
    String realPhoneFilePath = "file:///c:/Other/";       // for a real mobile phone
    
    String platform = System.getProperty("microedition.platform");
    
    // print platform string out, to make sure how your emulator is named
            
            
    if (platform.equals("j2me")) { // emulator in use
    
        demoFileLocation = emulatorFilePath + demoFileLocation;
    
    } else { // real mobile phone in use
    
        demoFileLocation = realPhoneFilePath + demoFileLocation;
                
    }
    When you've got the right URL, the rest is simple. Try this example: http://developers.sun.com/techtopics...mmapioverview/

    Or Nokia's MediaSampler example: http://www.forum.nokia.com/info/sw.n..._v1_0.zip.html
    Last edited by axs; 2007-03-29 at 08:08.

Similar Threads

  1. Unable to access memory card through jsr75...
    By pankaj_hotwani in forum Mobile Java General
    Replies: 12
    Last Post: 2008-12-14, 19:44
  2. transfer of messages from one memory card to another
    By theabrar in forum Smart Messaging
    Replies: 1
    Last Post: 2006-09-01, 13:28
  3. Replies: 1
    Last Post: 2004-01-13, 23:16
  4. RealOne Player 3.1.162 doesn't let me view memory card contents
    By gypsy182 in forum Streaming and Video
    Replies: 1
    Last Post: 2003-04-24, 17:47
  5. sms mesg deleted from card memory
    By topisystems in forum Multimodecards
    Replies: 1
    Last Post: 2002-09-20, 05:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×