private void showPostStatusScreen() statusBox = new TextBox("What's on your mind?", "", 200, TextField.ANY); sendCommand = new Command("Send", Command.OK, 1); backCommand = new Command("Back", Command.BACK, 2); statusBox.addCommand(sendCommand); statusBox.addCommand(backCommand); statusBox.setCommandListener(this); display.setCurrent(statusBox);
private Vector statuses; private Vector authors; private Vector times; facebook java jar 240x320
private void showAlert(String title, String message) Alert alert = new Alert(title, message, null, AlertType.INFO); alert.setTimeout(2000); display.setCurrent(alert, feedList); sendCommand = new Command("Send"
private void showMainForm() mainForm = new Form("Facebook 240x320"); mainForm.append("Welcome, User!\n"); mainForm.append("Latest updates:\n\n"); feedList = new List("News Feed", List.IMPLICIT); for (int i = 0; i < authors.size(); i++) String item = authors.elementAt(i) + ":\n" + truncate((String)statuses.elementAt(i), 30) + "\n" + times.elementAt(i); feedList.append(item, null); exitCommand = new Command("Exit", Command.EXIT, 1); postCommand = new Command("Post", Command.SCREEN, 2); refreshCommand = new Command("Refresh", Command.SCREEN, 3); feedList.addCommand(exitCommand); feedList.addCommand(postCommand); feedList.addCommand(refreshCommand); feedList.setCommandListener(this); display.setCurrent(feedList); backCommand = new Command("Back"
private void refreshFeed() // Simulate network refresh loadingAlert = new Alert("Loading", "Refreshing news feed...", null, AlertType.INFO); loadingAlert.setTimeout(1500); display.setCurrent(loadingAlert, feedList); // In real app, you'd fetch from network here // For demo, just rebuild the list feedList.deleteAll(); for (int i = 0; i < authors.size(); i++) String item = authors.elementAt(i) + ":\n" + truncate((String)statuses.elementAt(i), 30) + "\n" + times.elementAt(i); feedList.append(item, null);
private void postStatus(String message)
// FacebookMIDlet.java // A Facebook-style client for 240x320 Java ME phones // Compiles with WTK, runs on J2ME / MIDP 2.0, CLDC 1.1 import javax.microedition.midlet. ; import javax.microedition.lcdui. ; import java.util.*;