第一碼如何嘗試在if條件
try {
InputStream is = getAssets().open("read_asset.txt");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
String text = new String(buffer);
TextView tv = (TextView)findViewById(R.id.text);
tv.setText(text);
} catch (IOException e) {
throw new RuntimeException(e);
}
,這第二個代碼
if(txtweb.getText().toString().equals("Google Plus")) {
setContentView(R.layout.google);
} else if(txtweb.getText().toString().equals("Twitter")){
setContentView(R.layout.google);
}
我想結合嘗試代碼放到if條件,請幫助
剛把第二個代碼移到第一個代碼中有什麼問題? –
你是做什麼的?你的觀點並不清楚。 – javadaskari