Переглянути джерело

1.修改Android Apex Drivers显示上传位置对话框时判断Activity是否为空。

Pen Li 7 роки тому
батько
коміт
13f5e4f874

+ 21 - 19
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/ApexDriverApplication.java

@@ -536,26 +536,28 @@ public class ApexDriverApplication extends Application {
             break;
             case BackgroundReportTypeAlways: {
 
-                new AlertDialog.Builder(mCurActivity)
-                        .setTitle("Warning")
-                        .setMessage("Report Location For Order:" + orderId)
-                        .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
-                            @Override
-                            public void onClick(DialogInterface dialog, int which) {
-
-                                String location = null;
-                                reportLocationForOrder(location,orderId);
-                            }
-                        })
-                        .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
-                            @Override
-                            public void onClick(DialogInterface dialog, int which) {
+                if (mCurActivity != null) {
+                    new AlertDialog.Builder(mCurActivity)
+                            .setTitle("Warning")
+                            .setMessage("Report Location For Order:" + orderId)
+                            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+                                @Override
+                                public void onClick(DialogInterface dialog, int which) {
 
-                                String reason = "Driver " + user +" cancel to report location";
-                                rejectReportLocation(reason,orderId);
-                            }
-                        })
-                        .show();
+                                    String location = null;
+                                    reportLocationForOrder(location,orderId);
+                                }
+                            })
+                            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+                                @Override
+                                public void onClick(DialogInterface dialog, int which) {
+
+                                    String reason = "Driver " + user +" cancel to report location";
+                                    rejectReportLocation(reason,orderId);
+                                }
+                            })
+                            .show();
+                }
 
             }
             break;