我写了一个有2个屏幕的应用程序。第一个屏幕由主类触发。单击第一个屏幕中的按钮即可打开第二个屏幕。
public class MyApp extends UiApplication{
public static void main(String[] args){
MyApp theApp = new MyApp();
theApp.enterEventDispatcher();
}
public MyApp(){
// Push a screen onto the UI stack for rendering.
pushScreen(new MyScreen());
}
}
public class MyScreen extends MainScreen implements FieldChangeListener
{
BasicEditField mEdit = null;
ButtonField mButton = null;
public MyScreen()
{
super();
mEdit = new BasicEditField("input: ", "some text");
add(mEdit);
mButton = new ButtonField("Go second screen");
mButton.setChangeListener(this);
add(mButton);
}
public void fieldChanged(Field field, int context)
{
if(mButton == field)
{
MyScreen2 scr = new MyScreen2();
scr.setTextValue(mEdit.getText());
UiApplication.getUiApplication().pushScreen(scr);
UiApplication.getUiApplication().popScreen(this);
}
}
}
public final class MyScreen2 extends MainScreen
{
String mTextValue = null;
LabelField mLabel = null;
public void setTextValue(String textValue)
{
mTextValue = textValue;
mLabel.setText(mTextValue);
}
public MyScreen2()
{
super();
mLabel = new LabelField();
add(mLabel);
}
}
它适用于9700模拟器,但不适用于智能手机。我想知道出了什么问题?我想知道智能手机是否阻止从我的电脑上加载应用程序?
我尝试签署.cod,但没有任何改变。
有什么想法吗?