package com.gofitness.www;
import android.app.Activity;
import android.os.Bundle
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class log extends Activity implements OnClickListener {
Button submit,bEdit, bGetInfo, bDelete;
TextView display;
EditText etRowInfo, username, password;
protected void onCreate(Bundle login) {
// TODO Auto-generated method stub
super.onCreate(login);
setContentView(R.layout.insert);
submit = (Button) findViewById(R.id.submit);
username = (EditText) findViewById(R.id.etUsername);
password = (EditText) findViewById(R.id.etPassword);
display = (TextView) findViewById(R.id.tvDisplay);
bEdit = (Button) findViewById(R.id.bEdit);
etRowInfo = (EditText) findViewById(R.id.etRowInfo);
bGetInfo = (Button) findViewById(R.id.bGetInfo);
bDelete = (Button) findViewById(R.id.bDelete);
submit.setOnClickListener(this);
etRowInfo.setOnClickListener(this);
}
public void onClick(View arg0) {
switch (arg0.getId()){
case R.id.submit:
display.setText("fdf");
boolean didItWork = true;
try{
String check = username.getText().toString();
String checkpass = password.getText().toString();
logindetails entry = new logindetails(log.this);
entry.open();
entry.createEntry(check, checkpass);
entry.close();
}catch (Exception e){
didItWork = false;
String error = e.toString();
display.setText(error);
}finally{
if (didItWork){
display.setText("WERKED");
}
}
break;
case R.id.bGetInfo:
display.setText("fdf");
String s = etRowInfo.getText().toString();
long l = Long.parseLong(s);
logindetails log = new logindetails(this);
log.open();
String returnedName = log.getName(l);
String returnedPassword = log.getPassword(l);
log.close();
password.setText(returnedPassword);
break;
case R.id.bEdit:
display.setText("fdf");
break;
case R.id.bDelete:
display.setText("fdf");
break;
}
}
}
似乎第一种情况有效,并且按钮更改了显示文本视图,但是其余按钮不起作用。单击后没有任何反应,但也没有错误。
有谁知道为什么会这样?
干杯