WEB开发网
开发学院手机开发Android 开发 android 开发网络程序 阅读

android 开发网络程序

 2010-09-14 23:41:00 来源:WEB开发网   
核心提示:public class Main extends ListActivity { private int mode = XML; // default @Override public void onCreate(Bundle savedInstanceState) { super.on

public class Main extends ListActivity {

private int mode = XML; // default
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText input = (EditText) findViewById(R.id.symbol);
final TextView symbolsList = (TextView) findViewById(R.id.symList);
final Button addButton = (Button) findViewById(R.id.addBtn);
final Button dlButton = (Button) findViewById(R.id.dlBtn);
addButton.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
String newSymbol = input.getText().toString();
if (symbolsList.getText() == null ||
symbolsList.getText().length() == 0){
symbolsList.setText(newSymbol);
} else {
StringBuilder sb =
new StringBuilder(symbolsList.getText());
sb.append(",");
sb.append(newSymbol);
symbolsList.setText(sb.toString());
}
input.setText("");
}
});
dlButton.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
String symList = symbolsList.getText().toString();
String[] symbols = symList.split(",");
symbolsList.setText("");
switch (mode){
case JSON :
new StockJsonParser().execute(symbols);
break;
case PROTOBUF :
new StockProtoBufParser().execute(symbols);
break;
default :
new StockXmlParser().execute(symbols);
break;
}
}
});
}
}

上一页  1 2 3 4 5 6 7 8  下一页

Tags:android 开发 网络

编辑录入:coldstar [复制链接] [打 印]
赞助商链接