我有这个代码:
public class IntroInventario extends Activity{
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.intro_inventario);
final Database db=new Database(this);
db.open();
Cursor password=db.dammi_password();
final EditText inserisci=(EditText) findViewById(R.id.inserisci_password);
Button entra_inventario=(Button) findViewById(R.id.entra_inventario);
TextView dimenticata=(TextView) findViewById(R.id.dimenticata_password);
final Toast toast=new Toast(this);
while(password.moveToNext()){
if(password.getString(password.getColumnIndex("password")).equals("")){
// primo accesso
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
Intent intent = new Intent(IntroInventario.this, InventarioNoPassword.class);
finish();
parentActivity.startChildActivity("InventarioNoPassword",intent);
}
}
db.close();
// inserisci password
entra_inventario.setOnClickListener(new OnClickListener(){
public void onClick(View v){
db.open();
Cursor password_2=db.dammi_password();
while(password_2.moveToNext()){
if(inserisci.getText().toString().equals(password_2.getString(password_2.getColumnIndex("password")))){
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
Intent intent = new Intent(getParent(), Inventario.class);
finish();
parentActivity.startChildActivity("Inventario",intent);
}else{
Toast.makeText(IntroInventario.this,"Password sbagliata",Toast.LENGTH_LONG);
toast.show();
}
}
db.close();
}
});
// password dimenticata
dimenticata.setOnClickListener(new OnClickListener(){
public void onClick(View v){
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
Intent intent = new Intent(getParent(), InventarioDimenticata.class);
finish();
parentActivity.startChildActivity("InventarioDimenticata",intent);
}
});
}
}
问题是,如果我在“// primo accesso”中,应用程序会自行关闭,而不是转到 InventarioNoPassword.class。这很奇怪,因为在我的其他项目中它有效。
logcat 告诉:12-07 12:43:46.756: W/InputManagerService(60): 在非聚焦客户端 com.android.internal.view.IInputMethodClient$Stub$Proxy@406705e8 (uid=10037 pid=649) 上开始输入