Blackberry: Getting uncaught exception java.lang.securityexception
- by Maxim Xion
here is my code to open an image file from SDcard in Blackberry
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
public class DisplayAnImage extends MIDlet
{
private Display mDisplay;
private Form mForm;
private Image pngBackground;
public void startApp()
{
try{
pngBackground = Image.createImage("file:///Media Card/test_image.png");
ImageItem img = new ImageItem("bg",pngBackground,
ImageItem.LAYOUT_EXPAND,"background",ImageItem.PLAIN);
mForm = new Form("MIDlet Developer Guide: Display an image.");
mForm.append(img);
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mForm);
}
catch(IOException e)
{
mForm.append(e.getMessage());
}
}
public void pauseApp()
{
}
public void destroyApp(boolean flag)
{
}
}
While I am running this app with giving all permission to app it shows me "uncaught exception java.lang.securityexception". Please somebody help me on this.
Thanks in advance.. :-)