目前,我有兩(2)個SQLite表 - 用戶&訂婚。如何顯示SQLite存儲的數據有不同的用戶?
我已成功執行我的登錄活動並將其指向新的活動類--CodeActivity.java。
我的問題是,如何顯示CodeActivity類中的參與列表,因用戶而異,因爲我特別將每個用戶附加到不同的參與中。
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name=uname.getText().toString();
String password=pswd.getText().toString();
int id= checkUser(new User(name,password));
if(id==-1)
{
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Alert");
builder.setMessage("Username or Password is wrong.");
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
else
{
Intent intentLogin = new Intent(MainActivity.this, CodeActivity.class);
intentLogin.putExtra("name",name);
startActivity(intentLogin);
startActivity(intentLogin);
}
}
});
請幫助,我一直在這個問題上奮鬥了幾個星期。
你或許應該依靠web服務。 –
謝謝@Rotwang。我自己學習,仍然發現很多東西。 Arigatooo – xhanix
如果您的應用程序由必須訪問相同數據庫的不同用戶使用,我的建議纔有效。所以我明白了。 –