package elf.app;
import android.app.Activity;
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);
// }
}
}
Я получаю InvocationTargetException
и RuntimeException
.