ConnectionRequest r = new ConnectionRequest() {
protected void readResponse(InputStream input) throws IOException {
String sError = "This would be set by server";
}
protected void postResponse() {
if (!sError.equals("error")
goBack();
}
};
ConnectionRequest does not have a constructor with StateMachine
ConnectionRequest r = new ConnectionRequest(StateMachine sm )
^^^ StateMachine cannot
be resolved to a variable.
There are no available imports for StateMachine.
ConnectionRequest r = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
//parse result for error } @Override protected void postResponse() { if (sResult.equals("error")) MessageBox.OK(sErrorMsg, "Unable to Save"); else { MessageBox.OK("Data Saved", "Info"); <<< Wont go back MessageBox.TOAST("Data Saved"); <<< goes back but Toast disappears immediately parent.showBack(); } } };
public class MessageBox {
public static void OK(String msg, String title) { Dialog.show(title, msg, "OK", null); } public static boolean OKCANCEL(String msg, String title) { return Dialog.show(title, msg, "OK", "Cancel"); } public static void TOAST(String msg) { TOAST(msg, 2500); } public static void TOAST(String msg, int delay) { ToastBar.Status status = ToastBar.getInstance().createStatus(); status.setMessage(msg); status.setExpires(delay); status.show(); }}