This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes null pointer exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "null pointer exception" Watch "null pointer exception" New topic

null pointer exception

kelvin susanto

Joined: Jul 12, 2009
Posts: 1
now i'm making j2me bluetooth application, and i get the problem when i want input data in handpone appication i get statement null pointer exception....

i not understand what this problem....
anyone can help me....
this coding libraryclient, that application tell null pointer exception...

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.*;

public final class LibraryClient extends MIDlet implements CommandListener {
static final int ALERT_TIMEOUT = 2000;
private final Command KELUAR_CMD = new Command("Keluar",Command.EXIT,1 );
private final Command OK_CMD = new Command( "Masuk", Command.SCREEN, 2 );
private final Form menu = new Form( "Bluetooth Library" );
private LibraryGUI LibraryBTClient = null;

public LibraryClient() {
menu.addCommand( KELUAR_CMD );
menu.addCommand( OK_CMD );
menu.setCommandListener( this );}

public void startApp() {
show( null );}

public void pauseApp() {}

public void destroyApp( boolean unconditional ) {
if ( LibraryBTClient != null ) {

public void commandAction( Command c, Displayable d ) {
if ( c == KELUAR_CMD ){
destroyApp( true );
if ( c == OK_CMD ){
LibraryBTClient = new LibraryGUI( this );}}

void show( Alert a ) {
if ( a == null ){
Display.getDisplay(this).setCurrent( a, menu );}}
Displayable getDisplayable(){
return menu;}

and coding input data:

String jdl = judul.getString();
String dataPacket= "JUDUL_STATE;" + jdl + ";";
if ( jdl.equals( "" ) || jdl == null ) {
Alert a = new Alert( "Error","Inputan Judul Data Kurang !!", null, AlertType.ERROR );
a.setTimeout( LibraryClient.ALERT_TIMEOUT );
Display.getDisplay( parent ).setCurrent( a,formDisplay_judul);
} else {
formSendData.addCommand( DETAIL_INPUT_JUDUL );
formSendData.append(new Gauge("Pengiriman Data Judul",false,
bc_client.Send_Req(dataPacket, 1 );
Display.getDisplay( parent ).setCurrent( formSendData );
Roel De Nijs

Joined: Jul 19, 2004
Posts: 5449

Hi Kelvin,

Welcome to the javaranch!

I think this is not the best forum for your question, because it's here about scjd certification. This forum would be much better. I guess one of the bartenders (or someone with the correct powers ) will move your thread to this forum.

Kind regards,

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61450

Moved. Yes, please take the time to choose an appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: null pointer exception