JavaME problem uruchomieniem programu po kompilacji

0

Witam
posiada taki kod
kod ma za zadanie odczytać dane spilt oraz zwinąć linijkę stringu w menu
z kodem
.....
as[k] = (String)vector.elementAt(k);
....
program kompiluje bez problemu ale nie zwija wierszy, natomiast
.............
as[k] = ((spilt_m)vector.elementAt(k)).string;
....................
program się kompiluje ale wyskakuje błąd

Starting emulator in execution mode
Installing suite from: http://127.0.0.1:51105/test.jad
6850 - ERROR - JSR258 - 3 - Can't create MediaObject: media file (screen.image_bg.png) is not found
7117 - ERROR - JSR258 - 3 - Can't find theme element (feature=activeScreen, role=background)
7127 - ERROR - JSR258 - 3 - Can't find theme element (feature=inputMode, role=backgroundImage)
7147 - CRITICAL - JSR258 - 3 - Can't find Chameleon element (id=161)
7148 - CRITICAL - JSR258 - 3 - Can't find Chameleon element (id=163)
7148 - CRITICAL - JSR258 - 3 - Can't find Chameleon element (id=164)
7149 - CRITICAL - JSR258 - 3 - Can't find Chameleon element (id=165)
7152 - CRITICAL - JSR258 - 3 - Can't find Chameleon element (id=182)
7159 - ERROR - JSR258 - 3 - Can't find theme element (feature=systemMenu, role=selectedItemBackground)
7168 - ERROR - JSR258 - 3 - Can't find theme element (feature=virtualKeyboard, role=virtualKeyboardBGImage)
WARNING - MMA - C:/Builds/jme-sdk/javacall-javame-sdk-305/implementation/share/jsr135_mmapi/ju_mmconfig.c line 801: caps: optional settings missing: SuspendBehavior
TRACE: <at java.lang.ClassCastException: 0>, startApp threw an Exception
java.lang.ClassCastException: 0

  • hello.spilt_m.split(spilt_m.java:49)
  • hello.Midlet.a(Midlet.java:73)
  • hello.Midlet.startApp(Midlet.java:50)
    at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=273
    at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    java.lang.ClassCastException: 0
  • hello.spilt_m.split(spilt_m.java:49)
  • hello.Midlet.a(Midlet.java:73)
  • hello.Midlet.startApp(Midlet.java:50)
    at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=273
    at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    7622 - ERROR - JSR258 - 1 - AmsThemeManagerClient: can't receive data from the isolate - caught exception: java.io.EOFException
    javacall_lifecycle_state_changed() lifecycle: event is JAVACALL_LIFECYCLE_MIDLET_SHUTDOWN status is JAVACALL_OK

jaką komendę dodać do menu append, żeby funkcja
as[k] = ((spilt_m)vector.elementAt(k)).string;
zadziałała

podaje kod

public class spilt_m
{
     public String string; 
    private Vector vector_a;

     public  spilt_m(String string1, spilt_m aw[])
    {
    string = string1;
        if(aw != null && aw.length > 0)
        {
            vector_a = new Vector(aw.length);

            for(int l = 0; l < aw.length; l++)
            {
    spilt_m  w1 = aw[l];
            vector_a.addElement(w1);
            } 
        }   
    }
       public static String[] split(String s, String s1)
    {
        Vector vector = new Vector();
        String s2 = new String(s);
        for(int i = s2.indexOf(s1); i >= 0; i = s2.indexOf(s1))
        {
            vector.addElement(s2.substring(0, i));
            s2 = s2.substring(i + s1.length());
        }

        vector.addElement(s2);
        String as[] = new String[vector.size()];

        if(as.length > 0)
        {
             for(int k = 0; k < vector.size(); k++)
            as[k] =  (String)vector.elementAt(k);    <====w tym miejcu jak napiszę as[k] =  ((spilt_m)vector.elementAt(k)).string;

        }
        return as;
    }
}

dziękuje
to są moje początki

1
  1. Po co robisz coś w JavaME?
  2. dodajesz do vectora elementy String, a nie split_m ... więc co się dziwisz?

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0