我在我的应用程序中使用 ProgressDialog,但在运行应用程序时发生错误。
这是代码
public class MainActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
ProgressDialog mDialog = new ProgressDialog(getApplicationContext());
mDialog.setMessage("Loading...");
mDialog.setCancelable(false);
mDialog.show();
}
}
更新代码:
公共类 MainActivity 扩展 Activity{
public static ProgressDialog dialog;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
private static abstract class DictionaryOpenHelper extends SQLiteOpenHelper {
public DictionaryOpenHelper() {
super(null, null, null, 0);
// TODO Auto-generated constructor stub
}
public void onCreate() {
// TODO Auto-generated method stub
ProgressDialog dialog = ProgressDialog.show(DictionaryOpenHelper.this, "",
"Loading. Please wait...", true);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
}
}
并在 ProgressDialog 对话框上给出错误 = ProgressDialog.show(DictionaryOpenHelper.this, "", "Loading. Please wait...", true); :
ProgressDialog 类型中的方法 show(Context, CharSequence, CharSequence, boolean) 不适用于参数 (MainActivity.DictionaryOpenHelper, String, String, boolean)