【发布时间】:2013-01-12 20:09:43
【问题描述】:
在我的 android 应用程序中,我使用 goto 语句来控制流程。但我收到错误为“token goto 的语法错误,抛出预期”。这是我的代码
label:
if(alc)
{
r_code=st.nextToken();
AlertDialog.Builder alert=new AlertDialog.Builder(Fetch.this);
alert.setTitle(count+" records found for "+rytname.getText().toString());
alert.setMessage("Are you sure want to search for "+r_code+"?");
alert.setPositiveButton("YES", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ff=1;
alc=false;
}
});
alert.setNegativeButton("NO", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
ff=0;
}
});
alert.show();
if (ff==0)
{
goto label;
}
我是这个 android 的新手,帮我避免这个错误
【问题讨论】:
-
好的,但是如何避免这个错误呢?
-
Java 中没有 goto。它是一个保留字,但未被使用。
-
仍在使用
goto的人???
标签: android