.PNG with Audio
1 posts in topic
Flat View  Flat View

Posted By:   Yogesh_Chugh
Posted On:   Wednesday, September 24, 2003 04:22 AM

Hi List..
I just want to make an application in which i want to display a still image like any .png picture on the mibile display with some background music (any .wav or .mp3).
How can I make that application? Is it possible to get picture of any other format rather than .png?
Can anyone give me any code or some link where i cud get some coding help...Please help me out...
Thanks in advance...

Re: .PNG with Audio

Posted By:   Anonymous  
Posted On:   Friday, October 10, 2003 09:23 AM


it is not possible to get picture of any other format rather than .png.

To play sound, here is a class definition that can maybe help you:

import java.io.*;

import javax.microedition.media.*;

public class SoundPlayer{

private InputStream inputStream;

private String type = new String();

public SoundPlayer(String resource, String type) throws IOException{

if (resource == null || resource.length() == 0 || type == null || type.length() == 0)

throw new IOException("Fichier inexistant");

inputStream = getClass().getResourceAsStream(resource);

if (inputStream == null)

throw new IOException("Ressource " + resource + " inexistante");


this.type = type;




public SoundPlayer(InputStream inputstream, String type) throws IOException {

if (inputstream == null || type == null || type.length() == 0) {

throw new IOException("InputStream null");



this.inputStream = inputstream;

this.type = type;




void play(){

try {

Player p = Manager.createPlayer(inputStream, type);



catch (MediaException pe) {}

catch (Exception ioe) {}


public void close() throws IOException {

if (inputStream != null) {


inputStream = null;




and to use it in any other class:

declare a method to play the sound:

void playSoundMySound(){


SoundPlayer s = new SoundPlayer("/mysound.wav", "audio/x-wav");



catch(Exception e){}


and call it when tou want your sound to be played:


I hope that this could help you...

PS: excuse my very bad english...
About | Sitemap | Contact