gpt4 book ai didi

java - "Unreachable Statement"如何解决

转载 作者:行者123 更新时间:2023-11-29 05:08:19 37 4
gpt4 key购买 nike

这是我的 Android代码。我在下面的行 Toast 中有错误上面写着“Unreachable Statement”,我知道这个错误来自 return我的If但是不知道怎么解决

错误部分:

do
{
return;
if ((paramAnonymous2Int == 0) && (AndroidHTMLActivity.this.Count == 4))
{
Toast.makeText(getApplicationContext(),"نسخه رایگان",Toast.LENGTH_SHORT).show();
return;
}
}

整个函数:

@JavascriptInterface
public void SaveDialog(final String paramString)
{
final SQLiteDatabase mydatabase = openOrCreateDatabase("CopyCollection", MODE_PRIVATE, null);
Object localObject = mydatabase.rawQuery("SELECT * FROM Details WHERE ID=" + paramString + ";", null);
if (((Cursor)localObject).moveToFirst()) {
do
{
AndroidHTMLActivity.this.appName = ((Cursor)localObject).getString(1);
AndroidHTMLActivity.this.txtClip = ((Cursor)localObject).getString(2);
AndroidHTMLActivity.this.text_Date = ((Cursor)localObject).getString(3);
} while (((Cursor)localObject).moveToNext());
}
localObject = new AlertDialog.Builder(AndroidHTMLActivity.this);
((AlertDialog.Builder)localObject).setTitle("ذخیره");
((AlertDialog.Builder)localObject).setPositiveButton("ذخیره", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
final SQLiteDatabase mydatabase1 = openOrCreateDatabase("CopyCollection", MODE_PRIVATE, null);
Cursor crs = mydatabase1.rawQuery("SELECT * FROM Groups;",null);
String[] array = new String[crs.getCount()];
int[] arrayID = new int[crs.getCount()];
Count = crs.getCount();
int i = 0;
while(crs.moveToNext()){
String uname = crs.getString(crs.getColumnIndex("GroupName"));
int id = crs.getColumnIndex("ID");
arrayID[i] = id;
array[i] = uname;
i++;
}
final AlertDialog.Builder builder = new AlertDialog.Builder(AndroidHTMLActivity.this);
builder.setTitle("گروه خود را انتخاب کنید");
builder.setItems(paramAnonymousDialogInterface, new DialogInterface.OnClickListener()
{
public void onClick(final DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
{
strI = String.valueOf(paramAnonymous2Int);
String localObject1 = String.valueOf(paramAnonymous2Int);
final SQLiteDatabase mydatabase = openOrCreateDatabase("CopyCollection", MODE_PRIVATE, null);
Cursor localObject2 = mydatabase.rawQuery("SELECT * FROM Status WHERE ID=1;", null);
if ((localObject2).moveToFirst()) {
do
{
AndroidHTMLActivity.this.Trial = (localObject2).getInt(1);
} while ((localObject2).moveToNext());
}
if ((paramAnonymous2Int == 0) && (AndroidHTMLActivity.this.Count != 4))
{
final AlertDialog.Builder builder1 = new AlertDialog.Builder(AndroidHTMLActivity.this);
builder1.setTitle("درج عنوان گروه");
final EditText input = new EditText(AndroidHTMLActivity.this);
input.setInputType(1);
builder1.setView(input);
builder1.setPositiveButton("تایید", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramAnonymous3DialogInterface, int paramAnonymous3Int)
{
m_Text = input.getText().toString();
mydatabase.execSQL("INSERT INTO Groups (GroupName) VALUES('" + m_Text + "');");
Cursor c3 = mydatabase.rawQuery("SELECT * FROM Groups ORDER BY ID DESC LIMIT 1;", null);
if ((c3 != null) && (c3.moveToFirst()))
{
long l = c3.getLong(0);
LastDir = String.valueOf(l);
}
mydatabase.execSQL("INSERT INTO MainContent(AppName,Txt,GroupID,Time)VALUES('" + appName + "','" + txtClip + "','" + LastDir + "','" + text_Date + "');");
mydatabase.execSQL("DELETE FROM Details WHERE ID = " + paramString + ";");
mydatabase.close();
}
});
builder1.setNegativeButton("انصراف", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramAnonymous3DialogInterface, int paramAnonymous3Int)
{
paramAnonymous3DialogInterface.cancel();
AndroidHTMLActivity.this.myBrowser.post(new Runnable()
{
public void run()
{
myBrowser.loadUrl("javascript:fill_comment()");
}
});
}
});
builder1.show();
}
do
{
return;
if ((paramAnonymous2Int == 0) && (AndroidHTMLActivity.this.Count == 4))
{
Toast.makeText(getApplicationContext(),"نسخه رایگان",Toast.LENGTH_SHORT).show();
return;
}
}
while (paramAnonymous2Int == 0);
Cursor c2 = mydatabase.rawQuery("SELECT count(*) FROM `MainContent` WHERE `GroupID` LIKE '" + localObject1 + "'", null);
(c2).moveToFirst();
if ((c2).getInt(0) < 5)
{
mydatabase.execSQL("INSERT INTO MainContent (AppName,Txt,GroupID,Time) VALUES('" + AndroidHTMLActivity.this.appName + "','" + AndroidHTMLActivity.this.txtClip + "','" + (String)localObject1 + "','" + text_Date + "');");
mydatabase.execSQL("DELETE FROM Details WHERE ID = " + paramString + ";");
mydatabase.close();
}
Toast.makeText(getApplicationContext(),"نسخه رایگان",Toast.LENGTH_SHORT).show();
AndroidHTMLActivity.this.myBrowser.post(new Runnable()
{
public void run()
{
AndroidHTMLActivity.this.myBrowser.loadUrl("javascript:fill_comment()");
}
});
}
});
builder.create().show();
}
});
((AlertDialog.Builder)localObject).setNegativeButton("اشتراک گذاری", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
{
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
String str = txtClip;
intent.putExtra("android.intent.extra.SUBJECT", "Subject");
intent.putExtra("android.intent.extra.TEXT", str);
startActivity(Intent.createChooser(intent, "Share via"));
}
});
((AlertDialog.Builder)localObject).show();
}

@JavascriptInterface
public void configuration()
{
Intent localIntent = new Intent(AndroidHTMLActivity.this, Directory.class);
AndroidHTMLActivity.this.startActivity(localIntent);
AndroidHTMLActivity.this.finish();
}

最佳答案

看这段代码

return;
if ((paramAnonymous2Int == 0) && (AndroidHTMLActivity.this.Count == 4))

你在验证之前返回,因此永远不会到达它。

关于java - "Unreachable Statement"如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29632427/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com