InvocationTargetException & RuntimeException
package elf.app;
import android.app.Activi开发者_如何转开发ty;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.EditText;
public class MainLoginActivity extends Activity {
private EditText et_UserName;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
et_UserName = (EditText) findViewById(R.id.editText1);
et_UserName.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN)
&& (keyCode == KeyEvent.KEYCODE_ENTER)) {
logIn();
return true;
}
return false;
}
});
}
public void logIn(View view) {
logIn();
}
public void logIn() {
String loginStr = et_UserName.getText().toString();
// boolean valid = TCPIP.send(loginStr);
// if(valid==true) {
Intent intent = new Intent(this, RoomListActivity.class);
intent.putExtra("loginUser", loginStr);
this.startActivity(intent);
// }
}
}
I get InvocationTargetException
and RuntimeException
.
精彩评论