File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "null pointer exception" Watch "null pointer exception" New topic
Author

null pointer exception

kelvin susanto
Greenhorn

Joined: Jul 12, 2009
Posts: 1
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
Bartender

Joined: Jul 19, 2004
Posts: 5597
    
  15

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


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61762
    
  67

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: http://aspose.com/file-tools
 
subject: null pointer exception