This discussion is archived
0 Replies Latest reply: Jul 14, 2012 10:01 AM by 949459 RSS

[help] My App can't play mp2 or another audio

949459 Newbie
Currently Being Moderated
hey guys, please help me to correct my app, my problem why this app can't play mp3.


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Tajwid;

import javax.microedition.midlet.*;

import com.sun.lwuit.*;
import com.sun.lwuit.animations.*;
import com.sun.lwuit.events.*;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.*;
import com.sun.lwuit.util.Resources;
import java.io.IOException;
import java.io.InputStream;
import java.util.Hashtable;
import javax.microedition.media.*;
import javax.microedition.media.control.VolumeControl;

/**
* @author Muhamad BUrhanudin
*/
public class Tajwid extends MIDlet implements ActionListener {

Form mHomeForm, mhelpForm, mMenuTajwid;
Command mExitCommand;
Button btMenu;
// Nun Sukun dan Tanwin
Form mNunSukunTanwin;
Button btIdzhar, btIdghaam, btIqlab, btIkhfaa;
Form mIdzhar, mIdgham, mIqlab, mIkhfa;
//Mim Mati
Form mMimMati;
Button btIkhfasyafawi, btIdghamMimi, btIdzharSyafawi;
Form mIkhfaSyafawi, mIdghamMimi, mIdzharSyafawi;
//Mim Tasydid dan Nun Tasydid
Form mMimTasydidNun;
//Lam Tarif
Form mLamTarif, mIdzharQomariyah, mIdzharSyamsi;
Button btIdzharQomar, btIdzharSyamsi;
Button btNunSukun, btMimSukun, btplay, btNunTasjid;
Button btLamtarif, btIdgham, btMaad, btRaa;
Button btHelp;
Button btExit;
Command mBackCommand, mSelect;
private Player player;
private VolumeControl vc;

public void startApp() {
Display.init(this);

Resources r;
try {
r = Resources.open("/LWUITtheme.res");
UIManager.getInstance().
setThemeProps(r.getTheme("LWUITDefault"));
} catch (IOException e) {
e.printStackTrace();
}
createUI();
mHomeForm.show();

}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void actionPerformed(ActionEvent ae) {
mhelpForm.setTransitionInAnimator(
Transition3D.createCube(400, false));

mMenuTajwid.setTransitionInAnimator(
Transition3D.createCube(400, false));


mMenuTajwid.setTransitionOutAnimator(
Transition3D.createCube(400, true));


mNunSukunTanwin.setTransitionInAnimator(
Transition3D.createCube(400, false));


mNunSukunTanwin.setTransitionOutAnimator(
Transition3D.createCube(400, true));


mhelpForm.setTransitionOutAnimator(
Transition3D.createCube(400, true));

if (ae.getSource() == btMenu) {
mMenuTajwid.show();
} else if (ae.getSource() == btHelp) {
mhelpForm.show();
} else if (ae.getSource() == mBackCommand) {
mHomeForm.show();
} else if ((ae.getCommand() == mExitCommand) || (ae.getSource() == btExit)) {
notifyDestroyed();
} else if (ae.getSource() == btNunSukun) {
mNunSukunTanwin.show();
} else if (ae.getSource() == btIdzhar) {
mIdzhar.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIdzhar.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIdzhar.show();
} else if (ae.getSource() == btIdghaam) {
mIdgham.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIdgham.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIdgham.show();
} else if (ae.getSource() == btIqlab) {
mIqlab.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIqlab.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIqlab.show();
} else if (ae.getSource() == btIkhfaa) {
mIkhfa.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIkhfa.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIkhfa.show();
} else if (ae.getSource() == btMimSukun) {
mMimMati.setTransitionInAnimator(
Transition3D.createCube(400, false));

mMimMati.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mMimMati.show();
} else if (ae.getSource() == btIkhfasyafawi) {
mIkhfaSyafawi.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIkhfaSyafawi.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIkhfaSyafawi.show();
} else if (ae.getSource() == btIdghamMimi) {
mIdghamMimi.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIdghamMimi.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIdghamMimi.show();
} else if (ae.getSource() == btIdzharSyafawi) {
mIdzharSyafawi.setTransitionInAnimator(
Transition3D.createCube(400, false));

mIdzharSyafawi.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mIdzharSyafawi.show();
} else if (ae.getSource() == btNunTasjid) {
mMimTasydidNun.setTransitionInAnimator(
Transition3D.createCube(400, false));

mMimTasydidNun.setTransitionOutAnimator(
Transition3D.createCube(400, true));

mMimTasydidNun.show();
} else if (ae.getSource() == btLamtarif) {
mLamTarif.setTransitionInAnimator(
Transition3D.createCube(400, false));


mLamTarif.setTransitionOutAnimator(
Transition3D.createCube(400, true));
mLamTarif.show();
} else if (ae.getSource() == btplay) {
try {
InputStream is = getClass().getResourceAsStream("file://test.mp3");
player = Manager.createPlayer(is, "audio/mp3");

player.realize();
// get volume control for player and set volume to max
vc = (VolumeControl) player.getControl("VolumeControl");
if (vc != null) {
vc.setLevel(100);
}
player.prefetch();
player.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}

private void createUI() {
// Set up screen for transitions.
mhelpForm = new Form("Help Tajwid Learning");
TextArea lblhelp = new TextArea("Tajwid learning is simple "
+ "mobile application for use to mobiling system. "
+ "Developer By Muhamad Burhanudin");

mhelpForm.addComponent(lblhelp);
//Lam Tarif
mLamTarif = new Form("HUKUM LAM TA'RIEF");
mLamTarif.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
try {

Image gmb = Image.createImage("/list.png");
Image gmbIdzharQom = Image.createImage("/idQom.png");
Image gmbIdghamSyam = Image.createImage("/idSyam.png");
btIdzharQomar = new Button("Idzhar Qomariyah", gmbIdzharQom);
btIdzharQomar.addActionListener(this);
btIdzharQomar.getSelectedStyle().setBgColor(0xC0C0C0);
mLamTarif.addComponent(btIdzharQomar);

btIdzharSyamsi = new Button("Idgham Syamsiyah", gmbIdghamSyam);
btIdzharSyamsi.addActionListener(this);
btIdzharSyamsi.getSelectedStyle().setBgColor(0xC0C0C0);
mLamTarif.addComponent(btIdzharSyamsi);

} catch (Exception e) {
}
//end lam tarif
//Idzhar
try {
Image gmb = Image.createImage("/nun.png");
Image gmb2 = Image.createImage("/hrfidhar.png");
Image gmb3 = Image.createImage("/Conthidhar.png");
Image gmbplay = Image.createImage("/play.png");
mIdzhar = new Form("Idzhar");
TextArea lblIdzhar = new TextArea("Idzhar artinya jelas atau terang. Apabila ada "
+ " nun mati atau tanwin ");
TextArea lblIdzhar2 = new TextArea(" bertemu dengan salah "
+ " satu huruf halqi ");
TextArea lblIdzhar3 = new TextArea(" maka dibacanya jelas / terang. Contoh : ");

Label lbl = new Label(gmb);
Label lbl2 = new Label(gmb2);
Label lbl3 = new Label(gmb3);
Label lbl4 = new Label(gmbplay);
//lbl.setTextPosition(40);
mIdzhar.addComponent(lblIdzhar);
mIdzhar.addComponent(lbl);
mIdzhar.addComponent(lblIdzhar2);
mIdzhar.addComponent(lbl2);
mIdzhar.addComponent(lblIdzhar3);
mIdzhar.addComponent(lbl3);
btplay = new Button("Play", gmbplay);
btplay.addActionListener(this);
mIdzhar.addComponent(btplay);
//mIdzhar.addComponent(lblIdzhar2);
//mIdzhar.addComponent(lblIdzhar3);

} catch (Exception e) {
}

//Idghaam
try {

Image gmb = Image.createImage("/nun.png");
Image gmb2 = Image.createImage("/hrfidhom.png");
Image gmb3 = Image.createImage("/cthbcanidghm.png");
Image gmb4 = Image.createImage("/hrfidghmbilagnnh.png");
Image gmb5 = Image.createImage("/bcaanblaghunnah.png");
mIdgham = new Form("Bacaan Idgham");

TextArea lblIdgham = new TextArea("Idgham Bighunnah (dilebur dengan disertai dengung) "
+ "Yaitu memasukkan /meleburkan huruf nun mati atau tanwin ");
TextArea lblIdgham2 = new TextArea(" kedalam huruf sesudahnya dengan disertai (ber) dengung, jika bertemu dengan salah "
+ " satu huruf yang empat, yaitu ");
TextArea lblIdgham3 = new TextArea("Contoh : ");
TextArea lblIdgham6 = new TextArea("Contoh : ");
TextArea lblIdgham4 = new TextArea("Idgham Bilaghunnah (Dilebur tanpa dengung) Yaitu memasukkan / meleburkan huruf nun mati atau tanwin");
TextArea lblIdgham5 = new TextArea("kedalam huruf sesudahnya tanpa disertai dengung, jika bertemu dengan huruf lam atau ra ");

mIdgham.addComponent(lblIdgham);
Label lb = new Label(gmb);
Label lb6 = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
Label lb4 = new Label(gmb4);
Label lb5 = new Label(gmb5);
mIdgham.addComponent(lb);
mIdgham.addComponent(lblIdgham2);
mIdgham.addComponent(lb2);
mIdgham.addComponent(lblIdgham3);
mIdgham.addComponent(lb3);
mIdgham.addComponent(lblIdgham4);
mIdgham.addComponent(lb6);
mIdgham.addComponent(lblIdgham5);
mIdgham.addComponent(lb4);
mIdgham.addComponent(lblIdgham6);
mIdgham.addComponent(lb5);




} catch (Exception e) {
}

//Iqlab
try {

Image gmb = Image.createImage("/nun.png");
Image gmb2 = Image.createImage("/hrfiqlab.png");
Image gmb3 = Image.createImage("/iqlab.png");

mIqlab = new Form("Bacaan Iqlab");

TextArea lblIqlab = new TextArea("Iqlab artinya menukar atau mengganti. Apabila ada nun mati atau tanwin ");
TextArea lblIqlab2 = new TextArea(" bertemu dengan huruf ba ");
TextArea lblIqlab3 = new TextArea(" maka cara membacanya dengan menyuarakan /merubah "
+ " bunyi menjadi suara mim , dengan merapatkan dua bibir serta mendengung. Contoh:");
Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
mIqlab.addComponent(lblIqlab);
mIqlab.addComponent(lb);
mIqlab.addComponent(lblIqlab2);
mIqlab.addComponent(lb2);
mIqlab.addComponent(lblIqlab3);
mIqlab.addComponent(lb3);



} catch (Exception e) {
}


//Ikhfa
try {

Image gmb = Image.createImage("/nun.png");
Image gmb2 = Image.createImage("/hrfikhfa.png");
Image gmb3 = Image.createImage("/hrufikhfa.png");
Image gmb4 = Image.createImage("/cnthikhfa.png");

mIkhfa = new Form("Bacaan Ikhfa");
//mIkhfa.setScrollableY(true);
//mIkhfa.setScrollableX(true);
TextArea lblIkhfa = new TextArea("Ikhfa artinya menyamarkan atau tidak jelas. Apabila ada nun mati atau tanwin ");
TextArea lblIkhfa2 = new TextArea(" bertemu dengan salah satu huruf ikhfa yang 15 ");
TextArea lblIkhfa3 = new TextArea(" maka dibacanya samar-samar, antara jelas dan tidak "
+ "(antara izhar dan idgham) dengan mendengung. Contoh:");
Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
Label lb4 = new Label(gmb4);
mIkhfa.addComponent(lblIkhfa);
mIkhfa.addComponent(lb);
mIkhfa.addComponent(lblIkhfa2);
mIkhfa.addComponent(lb2);
mIkhfa.addComponent(lb3);
mIkhfa.addComponent(lblIkhfa3);
mIkhfa.addComponent(lb4);



} catch (Exception e) {
}

//Ikhfa Syafawi

try {

Image gmb = Image.createImage("/mim.png");
Image gmb2 = Image.createImage("/hrfiqlab.png");
Image gmb3 = Image.createImage("/cntohikhfasyfwi.png");

mIkhfaSyafawi = new Form("Bacaan Ikhfa Syafawi");

TextArea lblIkfasfwi = new TextArea("Ikhfa Syafawi Apabila mim mati ");
TextArea lblIkfasfwi2 = new TextArea(" bertemu dengan huruf ba ");
TextArea lblIkfasfwi3 = new TextArea("maka cara membacanya harus dibunyikan samar - samar di bibir dan didengungkan. Contoh : ");

Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
mIkhfaSyafawi.addComponent(lblIkfasfwi);

mIkhfaSyafawi.addComponent(lb);
mIkhfaSyafawi.addComponent(lblIkfasfwi2);
mIkhfaSyafawi.addComponent(lb2);
mIkhfaSyafawi.addComponent(lblIkfasfwi3);
mIkhfaSyafawi.addComponent(lb3);



} catch (Exception e) {
}

//Idgham Mimi

try {

Image gmb = Image.createImage("/mim.png");
Image gmb2 = Image.createImage("/mim2.png");
Image gmb3 = Image.createImage("/cthidgmmimi.png");

mIdghamMimi = new Form("Bacaan Idgham Mimi");

TextArea lblIdghamMimi = new TextArea("Idgham Mimi Apabila mim mati ");
TextArea lblIdghamMimi2 = new TextArea(" bertemu dengan huruf Mim ");
TextArea lblIdghamMimi3 = new TextArea("maka cara membacanya adalah seperti menyuarakan mim rangkap atau ditasyidkan dan wajib dibaca dengung. Idgham mimi disebut juga idgham mislain atau mutamasilain. Contoh : ");

Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
mIdghamMimi.addComponent(lblIdghamMimi);
mIdghamMimi.addComponent(lb);
mIdghamMimi.addComponent(lblIdghamMimi2);
mIdghamMimi.addComponent(lb2);
mIdghamMimi.addComponent(lblIdghamMimi3);
mIdghamMimi.addComponent(lb3);



} catch (Exception e) {
}

//Idzhar syafawi

try {

Image gmb = Image.createImage("/mim.png");
Image gmb2 = Image.createImage("/mimba.png");
Image gmb3 = Image.createImage("/cthidhrsyafawi.png");

mIdzharSyafawi = new Form("Bacaan Idzhar Syafawi");

TextArea lblIdzharSyafawi = new TextArea("Idzhar Syafawi Apabila mim mati ");
TextArea lblIdzharSyafawi2 = new TextArea(" bertemu dengan salah huruf Hijaiyyah selain huruf ");
TextArea lblIdzharSyafawi3 = new TextArea("maka cara membacanya dengan jelas di bibir dan mulut tertutup. Contoh :");

Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
mIdzharSyafawi.addComponent(lblIdzharSyafawi);
mIdzharSyafawi.addComponent(lb);
mIdzharSyafawi.addComponent(lblIdzharSyafawi2);
mIdzharSyafawi.addComponent(lb2);
mIdzharSyafawi.addComponent(lblIdzharSyafawi3);
mIdzharSyafawi.addComponent(lb3);



} catch (Exception e) {
}
//Mim Tasydid dan Nun Tasydid

try {

Image gmb = Image.createImage("/mimnuntsdid.png");
Image gmb2 = Image.createImage("/mimnuntasdid.png");
Image gmb3 = Image.createImage("/cthmimnuntasdid.png");

mMimTasydidNun = new Form("Hukum Mim tasydid dan Nun Tasydid");

TextArea lblIdzharSyafawi = new TextArea("Hukum Mim tasydid dan nun tasydid yaitu Apabila ada ");
TextArea lblIdzharSyafawi2 = new TextArea("maka dibaca dengan mendengung dan disebut dengan bacaan ghunnah ");
TextArea lblIdzharSyafawi3 = new TextArea("Contoh :");

Label lb = new Label(gmb);
Label lb2 = new Label(gmb2);
Label lb3 = new Label(gmb3);
mMimTasydidNun.addComponent(lblIdzharSyafawi);
mMimTasydidNun.addComponent(lb);
mMimTasydidNun.addComponent(lblIdzharSyafawi2);
mMimTasydidNun.addComponent(lb2);
mMimTasydidNun.addComponent(lblIdzharSyafawi3);
mMimTasydidNun.addComponent(lb3);



} catch (Exception e) {
}



//Form Menu Nun SUkun & Tanwin

mNunSukunTanwin = new Form("HUKUM NUN SUKUN & TANWIN");
mNunSukunTanwin.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
try {
Image gmb = Image.createImage("/list.png");
Image gmbIdzhar = Image.createImage("/idzhar.png");
Image gmbIdgham = Image.createImage("/idgham.png");
Image gmbIqlab = Image.createImage("/iqlab1.png");
Image gmbIkhfa = Image.createImage("/ikhfa.png");
btIdzhar = new Button("Idzhar", gmbIdzhar);
btIdzhar.addActionListener(this);
btIdzhar.getSelectedStyle().setBgColor(0xC0C0C0);
mNunSukunTanwin.addComponent(btIdzhar);

btIdghaam = new Button("Idgham", gmbIdgham);
btIdghaam.addActionListener(this);
btIdghaam.getSelectedStyle().setBgColor(0xC0C0C0);
mNunSukunTanwin.addComponent(btIdghaam);

btIqlab = new Button("Iqlab", gmbIqlab);
btIqlab.addActionListener(this);
btIqlab.getSelectedStyle().setBgColor(0xC0C0C0);
mNunSukunTanwin.addComponent(btIqlab);

btIkhfaa = new Button("Ikhfa'", gmbIkhfa);
btIkhfaa.addActionListener(this);
btIkhfaa.getSelectedStyle().setBgColor(0xC0C0C0);
mNunSukunTanwin.addComponent(btIkhfaa);

//End Nun Sukun

//Hukum Bacaan Mim Mati
mMimMati = new Form("HUKUM BACAAN MIM MATI");
mMimMati.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
try {
//Button Ikfasyafawi
btIkhfasyafawi = new Button("Ikhfa Syafawi");
btIkhfasyafawi.addActionListener(this);
btIkhfasyafawi.getSelectedStyle().setBgColor(0xC0C0C0);
mMimMati.addComponent(btIkhfasyafawi);

//Button Idgham Mimi
btIdghamMimi = new Button("Idgham Mimi");
btIdghamMimi.addActionListener(this);
btIkhfasyafawi.getSelectedStyle().setBgColor(0xC0C0C0);
mMimMati.addComponent(btIdghamMimi);

//Button Idzhar Syafawi
btIdzharSyafawi = new Button("Idzhar Syafawi");
btIdzharSyafawi.addActionListener(this);
btIdzharSyafawi.getSelectedStyle().setBgColor(0xC0C0C0);
mMimMati.addComponent(btIdzharSyafawi);

} catch (Exception e) {
}



mMenuTajwid = new Form("MENU DASAR TAJWID");
mMenuTajwid.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

btNunSukun = new Button("Hukum Nun Sukun & Tanwin", gmb);
btNunSukun.addActionListener(this);
btNunSukun.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btNunSukun);

btMimSukun = new Button("Hukum Mim Sukun", gmb);
btMimSukun.addActionListener(this);
btMimSukun.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btMimSukun);

btNunTasjid = new Button("Hukum Nun Tasydid & Min Tasydid", gmb);
btNunTasjid.addActionListener(this);
btNunTasjid.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btNunTasjid);

btLamtarif = new Button("Hukum Laam Ta'rief", gmb);
btLamtarif.addActionListener(this);
btLamtarif.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btLamtarif);

btIdgham = new Button("Idgham", gmb);
btIdgham.addActionListener(this);
btIdgham.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btIdgham);

btMaad = new Button("Maad", gmb);
btMaad.addActionListener(this);
btMaad.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btMaad);

btRaa = new Button("Raa'", gmb);
btRaa.addActionListener(this);
btRaa.getSelectedStyle().setBgColor(0xC0C0C0);
mMenuTajwid.addComponent(btRaa);
} catch (Exception e) {
}


mBackCommand = new Command("Back");
mMenuTajwid.addCommand(mBackCommand);
mMenuTajwid.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
mhelpForm.addCommand(mBackCommand);
mhelpForm.addCommandListener(this);
mNunSukunTanwin.addCommand(mBackCommand);
mNunSukunTanwin.addCommandListener(this);
mIdzhar.addCommand(mBackCommand);
mIdzhar.addCommandListener(this);
mIdgham.addCommand(mBackCommand);
mIdgham.addCommandListener(this);
mIqlab.addCommand(mBackCommand);
mIqlab.addCommandListener(this);
mIkhfa.addCommand(mBackCommand);
mIkhfa.addCommandListener(this);
mLamTarif.addCommand(mBackCommand);
mLamTarif.addCommandListener(this);

mMimMati.addCommand(mBackCommand);
mMimMati.addCommandListener(this);
mIkhfaSyafawi.addCommand(mBackCommand);
mIkhfaSyafawi.addCommandListener(this);

mIdghamMimi.addCommand(mBackCommand);
mIdghamMimi.addCommandListener(this);
mIdzharSyafawi.addCommand(mBackCommand);
mIdzharSyafawi.addCommandListener(this);
mMimTasydidNun.addCommand(mBackCommand);
mMimTasydidNun.addCommandListener(this);

// Set up main screen.
mHomeForm = new Form("Java Mobile Learning");
mHomeForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
try {
Image gmbar = Image.createImage("/quran.png");
Label x = new Label(gmbar);

Image gmb = Image.createImage("/folder.png");
btMenu = new Button("TAJWID LEARNING", gmb);
btMenu.addActionListener(this);
btMenu.getSelectedStyle().setBgColor(0xC0C0C0);
mHomeForm.addComponent(x);
mHomeForm.addComponent(btMenu);
} catch (Exception e) {
}


try {
Image gmb = Image.createImage("/help.png");
btHelp = new Button("HELP", gmb);
btHelp.addActionListener(this);
btHelp.getSelectedStyle().setBgColor(0xC0C0C0);
mHomeForm.addComponent(btHelp);
} catch (Exception e) {
}


try {
Image gmb = Image.createImage("/exit.png");
btExit = new Button("EXIT", gmb);
btExit.addActionListener(this);
btExit.getSelectedStyle().setBgColor(0xC0C0C0);
mHomeForm.addComponent(btExit);
} catch (Exception e) {
}

mExitCommand = new Command("Keluar");
mHomeForm.addCommand(mExitCommand);
mHomeForm.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
}

public void run() {
try {
InputStream is = getClass().getResourceAsStream("file://test.mp3");
player = Manager.createPlayer(is, "audio/mp3");

player.realize();
// get volume control for player and set volume to max
vc = (VolumeControl) player.getControl("VolumeControl");
if (vc != null) {
vc.setLevel(100);
}
player.prefetch();
player.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}

I Use Cofigure :
Device : DefaultfxTouchScreen
Device Configuration : CLDC 1.1
Device Profile : MIDP 2.1

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points