Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null pointer exception

 
kelvin susanto
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello....
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...
thanks...

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.*;
import java.io.*;

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 ) {
LibraryBTClient.destroy();}}

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

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


and coding input data:

if( c == TAMPILAN_DETAIL_JUDUL){
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);
return;
} else {
formSendData.deleteAll();
formSendData.addCommand( DETAIL_INPUT_JUDUL );
formSendData.append(new Gauge("Pengiriman Data Judul",false,
Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING ) );
bc_client.Send_Req(dataPacket, 1 );
Display.getDisplay( parent ).setCurrent( formSendData );
return;
}}
 
Roel De Nijs
Sheriff
Posts: 10232
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
Roel
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved. Yes, please take the time to choose an appropriate forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic