Help for a beginner....

2010-08-18
2013-04-25
  • Vialix Vialix

    Vialix Vialix - 2010-08-18

    I'd like to make MIDlet that will show the 0.txt resource. Under the text, there will be possibility of choice - choice 1 that open 1.txt and choice 2 that open 2.txt.

    I don't know how to do this. I read help files but still dont get it. Its something about forms and commands I guess?

    If you help me with this code, I will carry the rest out according to the scheme.

     
  • ptrg

    ptrg - 2010-08-18

    if the text files are in the JAR itself then yo need the openResource() function you can find it with example of usage in the documentation.

    Put choice1 and choice2 option on separate lines in the text file, so you can use readLine() to read lines from resource to string variables and display them in a menu, or button, or just check keypresses.

     
  • Vialix Vialix

    Vialix Vialix - 2010-08-18

    use readLine() to read lines from resource to string variables

    how to connect readLines() to that string thing?

    I have that:

    program NewProject;
    var res   : resource;
          byte  : integer;
          line  : string;
          index : integer;
      begin
          res := openResource('/0.txt');
          if (resourceAvailable(res)) then
          begin
              byte := readByte(res);
          line := readLine(res);
              closeResource(res);
          end;
          showForm;
          // I have to put somethhing there?
          delay(2000);
      end.
    
     
  • ptrg

    ptrg - 2010-08-18

    Try it like this:

    program HelpForABeginner;
    var
      res : resource;
      line1,line2 : string;
      cmd1, cmd2, clicked: command;
      i:Integer;
    begin
      res := openResource('/0.txt');
      if (resourceAvailable(res)) then begin
        line1 := readLine(res);
        line2 := readLine(res);
        closeResource(res);
      end;
      i:=formAddString('Select a command!');
      showForm;
      cmd1 := createCommand(Line1, CM_OK, 1);
      cmd2 := createCommand(Line2, CM_BACK, 2);
      addCommand(Cmd1);
      addCommand(Cmd2);
      repeat
        clicked := getClickedCommand;
      until clicked <> emptyCommand;
      clearForm;
      if clicked = cmd1 then begin
          i:=formAddString('Selected:'+Line1);
      end;
      if clicked = cmd2 then begin
          i:=formAddString('Selected:'+Line1);
      end;
      delay(2000);
    end.
    
     
  • adrian trent

    adrian trent - 2011-03-02

    Hi,

    Someone help me to make a MIDlet?
    I want to read an SMS (nonstop) and send it to a URL
    (http://…) and then delete it from the mobile memory.
    Message sent contains the sender number.
    Who helps me fix the price.

    Thanks

    Adrian

     
  • YellowAfterlife

    YellowAfterlife - 2011-03-18

    Hello, Adrian.

    Unfortunately, reading SMS, contained by mobile phone, is not possible via standart J2ME methods. That means that it may be avaible only to specific device models, where manufacter decided to drop security for potentially richer content range.

    Additionally, you should provide a revision to your list of moral actions. Dumping phone messages to web server is not exactly a legal thing to think about. You should consider developing either some conscience or trust, depending on specific goal behind your wish.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks