Hello i will like to have an explanation to this task:


Make a midlet (called "NetworkSettings") that has List (IMPLICIT type called "mainList") as its main view. "mainList" contains following items: "Encryption", "Basic data" and "Summary" (actually items will describe views). When user selects one of those items from "mainList" and clicks "Change view" command, new view will be shown (e.g. user selects "Basic data" -> "Basic data" -view will be shown). Implement "Change view" command by using SELECT_COMMAND of List object.

"Encryption" view is List that shows several encryption options (choose 4-6 encryption "items" and add them to List). User can select one or more options, but at least one option must select. Mark some option as selected when view is shown. When "Encryption" view is closed (it is up to you how you implement this), Alert view is shown for a couple of seconds (Alert view tells that user has succesfully selected following items ...) and "mainList" view will be shown.

"Basic data" view is Form that contains fields for name of network setting (use TextField) and type (use ChoiceGroup, add 3-5 items to list). User can select only one type (but one type has to select, mark some type as selected by default). Again, user can close "Basic data" view somehow and "mainList" will be shown.

"Summary" view is also Form that shows all data that user has gave (in different views). "Summary" view shows data as read-only. Encryption choices must be shown by using ChoiceGroup with popup-type.


Here is how i started it:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author emmas4impact
 */
public class NetworkingSetting extends MIDlet implements CommandListener {
    private List mainlist;
    private List encryotion;
    private Command changeview;
    private Form form;



    NetworkingSetting(){
        mainlist=new List("Main List",Choice.IMPLICIT);
        changeview=new Command("Change View",Command.ITEM,8);
        mainlist.append("Encryption", null);
        mainlist.append("Basic data", null);
        mainlist.append("Summary", null);
        mainlist.addCommand(changeview);
        

    }
    public void startApp() {
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable d){

    }

}

I dont understand how to go further can someone please help me out?

Dani AI

Generated

A short, practical plan for (and thanks to for the environment question): keep three Displayables (Encryption list, Basic data form, Summary form), store the user's choices in fields, and switch screens from the main IMPLICIT List by making your "Change view" Command the List's select command (use setSelectCommand and handle it in commandAction). This keeps the UI code straightforward and follows the MIDP List/select model. (docs.oracle.com)

Use startApp() to show the main List and register a CommandListener. In commandAction compare the incoming Displayable and the Command to route the user to the chosen view. Example wiring (trimmed to the essentials):

Display display = Display.getDisplay(this);
mainList.setSelectCommand(changeView);
mainList.setCommandListener(this);

public void startApp() {
  display.setCurrent(mainList);
}

public void commandAction(Command c, Displayable d) {
  if (d == mainList && c == changeView) {
    int sel = mainList.getSelectedIndex();
    if (sel == 0) display.setCurrent(encryptionList);
    else if (sel == 1) display.setCurrent(basicForm);
    else display.setCurrent(summaryForm);
  }
  // handle other screens' commands below...
}

For the Encryption view use a List with Choice.MULTIPLE, pre-mark options with setSelectedFlags (or setSelectedIndex for individual items), then read the selections with getSelectedFlags when the user closes the view. Show an Alert summarizing the picked items and return to the main List using Display.setCurrent(alert, mainList); set the Alert timeout to a couple seconds with setTimeout(2000). The Alert API will auto-advance to the next Displayable after the timeout when you use the default listener. (docs.oracle.com)

Make Basic data a Form with a TextField and an EXCLUSIVE ChoiceGroup (use setSelectedIndex to mark the default). For the Summary form append read-only StringItems for name/type, and present the chosen encryption options inside a ChoiceGroup created with Choice.POPUP — one practical approach is to append a single element containing the comma-separated selected algorithms so it appears as a popup read-only item. Use ChoiceGroup/Choice methods to populate and query these items. (docs.oracle.com)

Recommended Answers

All 2 Replies

Is this a problem that can only be solved in the ME enviroment?
Or can you write the basic menu/list/windows using standard JDK classes and then convert to ME?

There are more of us with the standard classes.

is a problem with ME environment.
Is it possible to write it with standard JDK classes and then convert it to ME?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.