我浪费了很多时间试图查找为什么这个alertDialog没有显示在我的其他状态,但是这里的IF语句是我的代码。
if (locManager.isProviderEnabled(LocationManager.GPS_PROVIDER) && locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){
setupMapIfRequired();
}else{
Log.d("turn on location Services", "turn on gps " + "a" + ": " + "aa");
Toast.makeText(this, "Please turn on gps provider location services...................", 1000).show();
startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
showDialog();
}
任何人都可以帮助我吗?注意 。这只是我代码上的问题区域所以我只发布了这个部分。如果我放置showDialog();代码可以工作;在IF语句中,但它在我调用位置服务设置的else部分不起作用。
这里是showDialog();功能
private void showDialog() {
// TODO Auto-generated method stub
AlertDialog.Builder ab = new AlertDialog.Builder(this);
ab.setTitle("Hello!!");
ab.setMessage("ALL ARE EQUAL");
ab.setCancelable(false);
ab.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
AlertDialog ad = ab.create();
ad.show();
}
这里是logcat
08-07 16:15:39.191: I/u(8104): Making Creator dynamically
08-07 16:15:39.241: I/Google Maps Android API(8104): Google Play services client version: 5077000
08-07 16:15:39.241: I/dalvikvm(8104): Could not find method gui.a, referenced from method gqh.a
08-07 16:15:39.241: W/dalvikvm(8104): VFY: unable to resolve static method 24934: Lgui;.a (Landroid/content/Context;)Lgrh;
08-07 16:15:39.241: D/dalvikvm(8104): VFY: replacing opcode 0x71 at 0x0003
08-07 16:15:39.241: E/dalvikvm(8104): Could not find class 'gpq', referenced from method gpr.a
08-07 16:15:39.241: W/dalvikvm(8104): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
08-07 16:15:39.241: D/dalvikvm(8104): VFY: replacing opcode 0x22 at 0x0000
08-07 16:15:39.241: E/dalvikvm(8104): Could not find class 'gpq', referenced from method gpr.a
08-07 16:15:39.241: W/dalvikvm(8104): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
08-07 16:15:39.241: D/dalvikvm(8104): VFY: replacing opcode 0x22 at 0x0000
08-07 16:15:39.241: E/dalvikvm(8104): Could not find class 'gpq', referenced from method gpr.a
08-07 16:15:39.241: W/dalvikvm(8104): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
08-07 16:15:39.241: D/dalvikvm(8104): VFY: replacing opcode 0x22 at 0x0000
08-07 16:15:39.241: D/dalvikvm(8104): DexOpt: unable to opt direct call 0x5ea1 at 0x0a in Lgpr;.a
08-07 16:15:39.241: D/dalvikvm(8104): DexOpt: unable to opt direct call 0x5ea1 at 0x0c in Lgpr;.a
08-07 16:15:39.241: D/dalvikvm(8104): DexOpt: unable to opt direct call 0x5ea1 at 0x0a in Lgpr;.a
08-07 16:15:39.241: I/Google Maps Android API(8104): Google Play services package version: 5089032
08-07 16:15:39.241: W/dalvikvm(8104): VFY: unable to resolve static field 20875 (t) in Lyo;
08-07 16:15:39.241: D/dalvikvm(8104): VFY: replacing opcode 0x62 at 0x000e
08-07 16:15:39.251: W/dalvikvm(8104): VFY: unable to resolve static field 20875 (t) in Lyo;
08-07 16:15:39.251: D/dalvikvm(8104): VFY: replacing opcode 0x62 at 0x000d
08-07 16:15:39.281: I/dalvikvm(8104): Failed resolving Lcom/google/android/gms/location /internal/ParcelableGeofence; interface 4023 'Lglm;'
08-07 16:15:39.281: W/dalvikvm(8104): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
08-07 16:15:39.281: E/dalvikvm(8104): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method gls.a
08-07 16:15:39.281: W/dalvikvm(8104): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lgls;
8-07 16:15:39.281: D/dalvikvm(8104): VFY: replacing opcode 0x1f at 0x0019
08-07 16:15:39.301: D/dalvikvm(8104): GC_CONCURRENT freed 972K, 31% free 7457K/10691K, paused 0ms+0ms
08-07 16:15:39.311: D/turn on location Services(8104): turn on gps a: aa
08-07 16:15:39.371: I/PGA(8104): New SOCKET connection: le.johjiprosign (pid 8104, tid 8104)