我有 2 个微调器,每个有 10 个值,现在我想要的是当用户选择 2 个值时返回另一个名为“YourPath”的活动的特定图片
这是第一个活动的代码
private Spinner spinner1, spinner2;
private Button btnSubmit;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.locationlist);
addListenerOnButton();
addListenerOnSpinnerItemSelection();
}
public void addListenerOnSpinnerItemSelection() {
spinner1 = (Spinner) findViewById(R.id.spinner1);
spinner2 = (Spinner) findViewById(R.id.spinner2);
}
public void addListenerOnButton() {
spinner1 = (Spinner) findViewById(R.id.spinner1);
spinner2 = (Spinner) findViewById(R.id.spinner2);
btnSubmit = (Button) findViewById(R.id.button1);
btnSubmit.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
AlertDialog alertDialog = new AlertDialog.Builder(
LocationList.this).create(); // Read Update
alertDialog.setTitle("Confirm Message");
alertDialog.setMessage("You are in "
+ String.valueOf(spinner1.getSelectedItem())
+ "\nAnd You are going to "
+ String.valueOf(spinner2.getSelectedItem()));
alertDialog.setButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
launchIntent();
}
});
alertDialog.setButton2("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
});
alertDialog.show();
}
private void launchIntent() {
Intent it = new Intent(LocationList.this, YourPath.class);
it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(it);
}
});
}
}
现在我需要一个数据库来做到这一点!
你有什么想法我该怎么做!!!!
谢谢