0

I'm trying to get to my nokia symbian S60 5th (NOKIA 5800) phone call logs using API Bridge. I followed the documentation from Nokia site but application doesn't work. The code is in Java ME. The problem is that I can't Initialize the API Bridge Midlet. This is the code. Thank you

package mobileapplication3;
import apibridge.*;
import apibridge.entities.*;
import com.sun.lwuit.*;
//
import java.util.*;
import java.util.Hashtable;
import java.util.Vector;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.location.Coordinates;
import javax.microedition.location.Criteria;
import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.LocationProvider;
import javax.microedition.lcdui.TextBox;
//
/*import  apibridge.LocationService;
import apibridge.LoggingService;
import  apibridge.APIBridge;
import  apibridge.HTTPManager;
import  apibridge.MediaManagementService;
import  apibridge.URLEncoder;
import  apibridge.NewFileService;
import apibridge.entities.*;*/


import javax.microedition.midlet.*;

public class Midlet extends MIDlet implements CommandListener {

private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command callLogCommand = new Command("Calllog", Command.ITEM, 2);
private final TextBox tbox = new TextBox("Result", "", 3000, 0);


public Midlet() {

    tbox.addCommand(exitCommand);
    tbox.addCommand(callLogCommand);
    tbox.setCommandListener(this);
    APIBridge apiBridge = APIBridge.getInstance();
    apiBridge.Initialize(this);
    tbox.setString("Prova ...");

}

1 Answers1

0

A MIDlet doesn't get started by its constructor. It gets started by the startApp() method.

So try moving everything inside your constructor, into a function called startApp().

public Midlet() {
}

public void startApp() {
 tbox.addCommand(exitCommand);
 tbox.addCommand(callLogCommand);
 tbox.setCommandListener(this);
 APIBridge apiBridge = APIBridge.getInstance();
 apiBridge.Initialize(this);
 tbox.setString("Prova ...");
}

See if that helps.

mr_lou
  • 1,910
  • 2
  • 14
  • 26