我正在使用Android應用程序。 該應用程序有一系列的表單,我想確認用戶在進入下一組表單之前填寫這些表單。什麼是最好的方式來做到這一點?不完整的表單提示 - Android
public void goOne()
{
setContentView(R.layout.main);
next = (Button) findViewById(R.id.next);
logo = (Button) findViewById(R.id.logo);
cityText = (EditText)findViewById(R.id.city);
about = (Button) findViewById(R.id.aboutus);
about.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
goAboutUs();
}
});
logo.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
goOne();
}
});
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
city = (String)cityText.getText().toString();
if(stateLoc.equalsIgnoreCase("international"))
{
location = "";
isInternational = 1;
}else
{
location = city;
}
if(cityText.getText().equals("") && stateLoc.equalsIgnoreCase("U.S.A"))
{
new AlertDialog.Builder(Tents.this)
.setTitle("Error")
.setMessage("Enter ZIP Code, or choice International ")
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
goOne();
}
}).show();
}else{
goTwo();
}
}
});
那是我的代碼。我正在嘗試驗證cityText文本框。如果它沒有任何東西,並且stateLoc被設置爲USA,那麼彈出警報,如果沒有,那麼goTwo()
我給在問題領域的一些詳細信息 – Zaask