У меня есть библиотека volley, дающая com.android.volley.ServerError

milad спросил: 28 апреля 2018 в 09:48 в: android

Я пытаюсь использовать метод post с JSONObjectRequest в своем приложении. Когда я пытаюсь вызвать API, используя библиотеку волейбола, он дает. Я ставлю logcat в нижней части страницы, пожалуйста, помогите мне об этом. я не нашел никаких решений.

com.android.volley.ServerError.

моя функция в действии:

  private void sendJsonArrayRequestAddOrder(final Context context)
    {
        String selectedDate = SelectedDate.split("-")[1].replace(" ","");
        User user = User.getInstance();
        String url = UrlManager.getUrl(this, R.string.AddOrder_url);
        url = url + "&mobile=" + user.Mobile + "&usercarId=" + SelectedUserCarId  + "&srvIds=" + SelectedServiceIds +
                "&pkgId=" + SelectedPackageId + "&ad=" + SelectedAddress + "&lat=" + SelectedLat + "&lng=" + SelectedLong +
                "&timeId=" + SelectedTimeId + "&date=" + selectedDate+ "&price=" + String.valueOf((long)Totalprice);        final ProgressDialog pDialog;
        pDialog = new ProgressDialog(this);
        pDialog.setMessage("Loading...");
        pDialog.setCancelable(false);
        pDialog.show();        Response.Listener<JSONObject> listener = new Response.Listener<JSONObject>()
        {
            @Override
            public void onResponse(JSONObject response)
            {
                try
                {
                    JSONObject orderObj = response;
                    String OrderCode = response.getString("OrderCode");                }
                catch (Exception e)
                {
                    Log.d("error", e.getMessage());
                    e.printStackTrace();
                }
                pDialog.dismiss();            }
        };        Response.ErrorListener errorListener = new Response.ErrorListener()
        {
            @Override
            public void onErrorResponse(VolleyError error)
            {
                error.printStackTrace();
                Toast.makeText(getBaseContext(), "error", Toast.LENGTH_LONG).show();
                pDialog.dismiss();
            }
        };        JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,null, listener, errorListener);
        MyApplication.getInstance().addToRequestQueue(request);
    }

Мой API Результат:

{"OrderId":44,"OrderCode":"2","Lang":"fa","UserId":80,"TotalPrice":100000.0000,"TotalPriceDouble":0,"TotalDiscount":0.0000,"Tax":0.0000,"RecipientAddress":"Tehran Province,Tehran,Vahidiyeh,Aminayi","Longitude":"51.467444971203804","Latitude":"35.70918888959564","CDate":"2018/05/22 15:40:16","WorkTimeId":1,"OrderStatus":1,"EmployeeId":0,"Employee":"","CarTypeId":2,"PackageTitle":"golden","OrderTrackCode":"","ReserveDate":"1397/03/02","UserCar":"bmw","FinishDateTime":"","IPRegister":""}

logcat:

05-30 12:00:13.155 3316-2730/? I/AsyncOpDispatcher: 35-GetDeviceDataUploadOptInStatusOperation
05-30 12:00:13.205 3316-2730/? I/AsyncOpDispatcher: 35-GetDeviceDataUploadOptInStatusOperation
05-30 12:00:13.235 3316-2730/? I/AsyncOpDispatcher: 35-GetDeviceDataUploadOptInStatusOperation
05-30 12:00:13.265 3316-2730/? D/SecWifiDisplayUtil: Metadata value : none
05-30 12:00:16.475 27888-27888/ir.carnawash.carnawash W/System.err: com.android.volley.ServerError
05-30 12:00:16.475 27888-27888/ir.carnawash.carnawash W/System.err:     at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:163)
05-30 12:00:16.475 27888-27888/ir.carnawash.carnawash W/System.err:     at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)
05-30 12:00:16.545 27888-27888/ir.carnawash.carnawash D/ViewRootImpl: #3 mView = null
05-30 12:00:16.545 1522-1708/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{3bafbff u0 d0 p27888 ir.carnawash.carnawash/ir.carnawash.carnawash.activity.ReviewOrderActivity}
05-30 12:00:16.555 2362-2362/? D/PhoneStatusBar: setSystemUiVisibility vis=8600 mask=ffffffff oldVal=8000 newVal=8600 diff=600
05-30 12:00:16.555 1522-6711/? D/InputDispatcher: Focus left window: 27888
05-30 12:00:16.555 1522-6711/? D/InputDispatcher: Focus entered window: 27888
05-30 12:00:16.555 1522-1795/? D/PointerIcon: setMouseIconStyle1 pointerType: 1001 iconType:101 flag:0 pid:1522 uid:1000
05-30 12:00:16.555 1522-1795/? D/PointerIcon: setMouseCustomIcon IconType is same.101
05-30 12:00:16.565 27888-27888/ir.carnawash.carnawash I/Choreographer: Skipped 15046 frames!  The application may be doing too much work on its main thread.
05-30 12:00:16.575 27888-27888/ir.carnawash.carnawash D/ViewRootImpl: #1 mView = android.widget.LinearLayout{b1ade83 V.E...... ......I. 0,0-0,0 #10203af android:id/toast_layout_root}
05-30 12:00:16.595 1522-2508/? D/InputMethodManagerService: windowGainedFocus mCurrentFocusedUserId - 0 and mSecureKeypadEnabled-false
05-30 12:00:16.595 1522-2508/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@7aca908 attribute=null, token = android.os.BinderProxy@7d7271e
05-30 12:00:16.595 1522-2508/? D/InputMethodManagerService: [HARDWARE_KEYBOARD] (refreshImeWindowVis) mImeWindowVis= 0 inputVisible = falsehaveHardKeyboard = false hardKeyShown = false
05-30 12:00:16.595 27888-27888/ir.carnawash.carnawash E/ViewRootImpl: sendUserActionEvent() mView == null
05-30 12:00:16.625 350-350/? I/SurfaceFlinger: id=6558 createSurf (1x1),1 flag=4, Uoast
05-30 12:00:16.645 1522-1544/? D/PowerManagerService: [api] acquire WakeLock flags=0x2000000a tag=WindowManager uid=1000 pid=1522
05-30 12:00:16.685 27888-27888/ir.carnawash.carnawash D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
05-30 12:00:16.755 350-5897/? I/SurfaceFlinger: id=6557 Removed SeviewOrder (6/9)
05-30 12:00:16.755 350-10675/? I/SurfaceFlinger: id=6557 Removed SeviewOrder (-2/9)
05-30 12:00:17.805 1522-5285/? D/SSRM:s: SIOP:: AP = 320, PST = 313 (W:26), CP = 41, LCD = 255
05-30 12:00:17.805 1522-5285/? D/ConnectivityService: returning getNetworkInfo for network type 1 : [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Milsacms.com", roaming: false, failover: false, isAvailable: true]
05-30 12:00:17.805 1522-5285/? D/SSRM:P: reading: 32 31 0
05-30 12:00:20.035 27888-27888/ir.carnawash.carnawash D/ViewRootImpl: #3 mView = null
05-30 12:00:20.045 1522-6247/? D/PowerManagerService: [api] [s] userActivity : event: 0 flags: 0 (uid: 1000 pid: 1522) eventTime = 279983866
05-30 12:00:20.045 1522-6247/? D/PowerManagerService: [api] release WakeLock flags=0x2000000a tag=WindowManager uid=1000 pid=1522 (0x0)
05-30 12:00:20.055 1522-6247/? D/PowerManagerService: [api] applyWakeLockFlagsOnReleaseLocked : userActivityNoUpdateLocked is called : SCREEN_BRIGHT_WAKE_LOCK        'WindowManager' ON_AFTER_RELEASE (uid=1000, pid=1522, ws=WorkSource{10210}) (elapsedTime=3419)
05-30 12:00:20.605 350-600/? I/SurfaceFlinger: id=6558 Removed Uoast (8/8)
05-30 12:00:20.605 350-5897/? I/SurfaceFlinger: id=6558 Removed Uoast (-2/8)
05-30 12:00:24.655 1522-2664/? E/Watchdog: !@Sync 9331 [05-30 12:00:24.660]
05-30 12:00:27.635 2362-2362/? D/StatusBar.MSimNetworkController: onSignalStrengthsChanged received on getPhoneId :0signalStrength=SignalStrength: 26 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte level=4
05-30 12:00:27.655 2362-2362/? D/StatusBar.MSimNetworkController: updateTelephonySignalStrength: iconLevel= 4, phoneId = 0
05-30 12:00:27.665 2362-2362/? D/StatusBar.MSimNetworkController: refreshViews connected={ wifi } phoneId = 0 level=4 mMSimcombinedSignalIconId=0x7f020720/com.android.systemui:drawable/stat_sys_wifi_signal_4 mMSimcombinedActivityIconId=0x7f0206ce mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f02069b/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f02069b mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x0/(null) mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f020720 mBluetoothTetherIconId=0x7f0206f7 mRoamingIconId=0x 0/(null)
05-30 12:00:27.665 2362-2362/? D/StatusBar.MSimNetworkController: refreshSignalCluster : called
05-30 12:00:27.665 2362-2362/? D/StatusBar.MSimNetworkController: refreshNwBoosterIndicator - setNWBoosterIndicators(false)
05-30 12:00:27.685 2362-2362/? D/StatusBar.MSimNetworkController: refreshNwBoosterIndicator - setNWBoosterIndicators(false)
05-30 12:00:27.865 1522-5285/? D/SSRM:s: SIOP:: AP = 320, PST = 313 (W:26), CP = 41, LCD = 255
05-30 12:00:27.865 1522-5285/? D/ConnectivityService: returning getNetworkInfo for network type 1 : [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Milsacms.com", roaming: false, failover: false, isAvailable: true]
05-30 12:00:27.875 1522-5285/? D/SSRM:P: reading: 32 31 0
05-30 12:00:37.965 1522-5285/? D/SSRM:s: SIOP:: AP = 320, PST = 313 (W:26), CP = 40, LCD = 255
05-30 12:00:37.965 1522-5285/? D/ConnectivityService: returning getNetworkInfo for network type 1 : [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Milsacms.com", roaming: false, failover: false, isAvailable: true]
05-30 12:00:37.965 1522-5285/? D/SSRM:P: reading: 32 31 0
05-30 12:00:38.495 1522-1783/? E/MARsDBManager: updateDBAll : begin --size 2
05-30 12:00:38.495 1522-1783/? D/MountService: getExternalStorageMountMode : 1
05-30 12:00:38.495 1522-1783/? D/MountService: getExternalStorageMountMode : 3
05-30 12:00:38.495 1522-1783/? D/MountService: getExternalStorageMountMode : final mountMode=1, uid : 1000, packageName : com.samsung.android.sm.provider
05-30 12:00:38.535 1522-1783/? I/ActivityManager: Start proc 3502:com.samsung.android.sm.provider/1000 for content provider com.samsung.android.sm.provider/com.samsung.android.sm.database.SmProvider
05-30 12:00:38.535 3502-3502/? E/Zygote: v2
05-30 12:00:38.535 3502-3502/? I/libpersona: KNOX_SDCARD checking this for 1000
05-30 12:00:38.535 3502-3502/? I/libpersona: KNOX_SDCARD not a persona
05-30 12:00:38.535 3502-3502/? W/SELinux: Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0013
05-30 12:00:38.605 3502-3502/? D/TimaKeyStoreProvider: TimaSignature is unavailable
05-30 12:00:38.605 3502-3502/? D/ActivityThread: Added TimaKeyStore provider
05-30 12:00:38.705 3502-3502/? W/System: ClassLoader referenced unknown path: /system/priv-app/SmartManagerProvider/lib/arm
05-30 12:00:38.785 1522-1522/? I/ActivityManager: Killing 27982:com.samsung.helphub/1000 (adj 15): DHA:empty #25
05-30 12:00:38.785 1522-1783/? E/MARsDBManager: updateDBAll : end
05-30 12:00:38.785 1522-1783/? D/MARsDBManager: onChange - mSmartManagerObserver! Uri = content://com.samsung.android.sm/AppFreezer?MARs-self=true&MARs=true
05-30 12:00:38.785 1522-1783/? D/MARsDBManager: onChange - mSmartManagerObserver! Uri = content://com.samsung.android.sm/AppFreezer?MARs-self=true&MARs=true
05-30 12:00:38.885 1522-6247/? D/ActivityManager: removeProcessNameLocked mProcessNames.remove pid=27982 ,hash=130881057 ,name=com.samsung.helphub
05-30 12:00:39.365 1522-2257/? D/BatteryService: !@BatteryListener : batteryPropertiesChanged!
05-30 12:00:39.365 1522-2257/? D/BatteryService: level:94, scale:100, status:3, health:2, present:true, voltage: 4171, temperature: 297, technology: Li-ion, AC powered:false, USB powered:false, POGO powered:false, Wireless powered:false, icon:17303586, invalid charger:0, maxChargingCurrent:0
05-30 12:00:39.365 1522-2257/? D/BatteryService: online:1, current avg:0, charge type:0, power sharing:false, high voltage charger:false, capacity:260000, batterySWSelfDischarging:false, current_now:0
05-30 12:00:39.375 1522-1522/? D/BatteryService: Sending ACTION_BATTERY_CHANGED.
05-30 12:00:39.375 1522-1522/? I/MotionRecognitionService: On Battery, 0
05-30 12:00:39.375 1522-1522/? D/MotionRecognitionService:   cableConnection= 0
05-30 12:00:39.375 1522-1522/? D/GameManagerService: new battery level: 94
05-30 12:00:39.375 2362-2362/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
05-30 12:00:39.385 2362-2362/? I/PERF: received broadcast android.intent.action.BATTERY_CHANGED
05-30 12:00:39.385 2362-2362/? D/KeyguardUpdateMonitor: handleBatteryUpdate
05-30 12:00:39.415 2362-2362/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:94 status:3 health:2
05-30 12:00:39.415 2362-2362/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:94 status:3 health:2
05-30 12:00:39.415 2362-2362/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:94 status:3 health:2
05-30 12:00:39.415 2362-2362/? D/CoverUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
05-30 12:00:39.415 2362-2362/? D/BatteryMeterView: ACTION_BATTERY_CHANGED : level:94 status:3 health:2
05-30 12:00:44.545 1522-2276/? D/NetworkPolicy: isUidForegroundLocked: 10009, mScreenOn: true, uidstate: 2, mProxSensorScreenOff: false
05-30 12:00:44.545 1522-2276/? D/NetworkPolicy: isUidForegroundLocked: 10009, mScreenOn: true, uidstate: 2, mProxSensorScreenOff: false
05-30 12:00:44.585 3316-14001/? E/WakeLock: release without a matched acquire!
05-30 12:00:47.465 2362-2362/? D/StatusBar.MSimNetworkController: onSignalStrengthsChanged received on getPhoneId :0signalStrength=SignalStrength: 26 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte level=4
05-30 12:00:47.485 2362-2362/? D/StatusBar.MSimNetworkController: updateTelephonySignalStrength: iconLevel= 4, phoneId = 0
05-30 12:00:47.485 2362-2362/? D/StatusBar.MSimNetworkController: refreshViews connected={ wifi } phoneId = 0 level=4 mMSimcombinedSignalIconId=0x7f020720/com.android.systemui:drawable/stat_sys_wifi_signal_4 mMSimcombinedActivityIconId=0x7f0206ce mAirplaneMode=false mMSimDataActivity=0 mMSimPhoneSignalIconId=0x7f02069b/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mMSimDataDirectionIconId=0x0 mMSimDataSignalIconId=0x7f02069b mMSimDataTypeIconId=0x0/(null) mNoMSimIconId=0x0/(null) mMSimMobileActivityIconId=0x0/(null) mWifiIconId=0x7f020720 mBluetoothTetherIconId=0x7f0206f7 mRoamingIconId=0x 0/(null)
05-30 12:00:47.485 2362-2362/? D/StatusBar.MSimNetworkController: refreshSignalCluster : called
05-30 12:00:47.495 2362-2362/? D/StatusBar.MSimNetworkController: refreshNwBoosterIndicator - setNWBoosterIndicators(false)
05-30 12:00:47.505 2362-2362/? D/StatusBar.MSimNetworkController: refreshNwBoosterIndicator - setNWBoosterIndicators(false)
05-30 12:00:48.065 1522-5285/? D/SSRM:s: SIOP:: AP = 320, PST = 313 (W:28), CP = 40, LCD = 255
05-30 12:00:48.065 1522-5285/? D/ConnectivityService: returning getNetworkInfo for network type 1 : [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Milsacms.com", roaming: false, failover: false, isAvailable: true]
05-30 12:00:48.075 1522-5285/? D/SSRM:P: reading: 32 31 0
05-30 12:00:52.445 7345-7364/? D/ContactsProvider_EventLog: contents_sample_state: [ contacts(323) data(1454) accounts({vnd.sec.contact.phone (1)=28, vnd.sec.contact.sim (2)=216, org.telegram.messenger (7)=329, com.whatsapp (9)=76, com.google (3)=2}) accounts deleted({org.telegram.messenger (7)=9}) calls([logtype:100 cnt:499, logtype:300 cnt:500, logtype:500 cnt:1])  ]
                                                            contents_sample_state: [ agr({[7 ,2 ,9]=1, [1 ,9 ,7 ,6]=2, [1]=6, [6]=59, [6 ,6 ,2]=1, [7]=16, [3 ,6 ,9 ,7]=1, [7 ,6]=4, [6 ,7 ,2 ,9]=10, [1 ,9 ,7]=4, [1 ,6 ,9 ,7]=1, [6 ,6 ,7 ,7 ,2 ,2 ,9]=1, [6 ,7 ,9 ,2]=28, [6 ,7 ,2]=21, [9 ,2]=4, [7 ,9 ,6 ,2]=6, [2]=78, [7 ,6 ,2 ,9]=3, [1 ,9 ,6 ,7]=2, [7 ,9 ,6 ,2 ,2]=1, [1 ,7 ,6 ,9]=1, [9]=1, [7 ,2]=4, [1 ,6 ,7]=6, [2 ,2 ,2]=1, [6 ,2]=47, [1 ,7 ,6]=1, [3 ,9 ,7 ,6]=1, [6 ,7]=1, [7 ,6 ,2]=2, [1 ,6 ,7 ,9]=3, [7 ,9 ,2]=4, [1 ,9]=2})  ]
05-30 12:00:52.515 7345-7364/? E/ContactsProvider_EventLog: Flush buffer to file cnt : 14 size : 22Kb duration : 48ms lastUpdatedAfter : 60171 ms mFlush_time_threasold : 2000 mCurrentSize : 11592
05-30 12:00:54.545 1522-2276/? D/NetworkPolicy: isUidForegroundLocked: 10009, mScreenOn: true, uidstate: 2, mProxSensorScreenOff: false
05-30 12:00:54.555 1522-2276/? D/NetworkPolicy: isUidForegroundLocked: 10009, mScreenOn: true, uidstate: 2, mProxSensorScreenOff: false
05-30 12:00:54.655 1522-2664/? E/Watchdog: !@Sync 9332 [05-30 12:00:54.662]
05-30 12:00:54.675 399-2056/? D/MDnsDS: MDnsSdListener::Monitor poll timed out
05-30 12:00:54.675 399-2056/? D/MDnsDS: Going to poll with pollCount 1
05-30 12:00:58.125 1522-5285/? D/SSRM:s: SIOP:: AP = 320, PST = 313 (W:28), CP = 40, LCD = 255
05-30 12:00:58.125 1522-5285/? D/ConnectivityService: returning getNetworkInfo for network type 1 : [type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Milsacms.com", roaming: false, failover: false, isAvailable: true]
05-30 12:00:58.125 1522-5285/? D/SSRM:P: reading: 32 31 0
05-30 12:01:00.005 2362-2362/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.TIME_TICK
05-30 12:01:00.005 2362-2362/? I/PERF: received broadcast android.intent.action.TIME_TICK
05-30 12:01:00.005 2362-2362/? D/KeyguardUpdateMonitor: handleTimeUpdate
05-30 12:01:00.025 2362-2362/? D/SecKeyguardClockView: onTimeChanged() : mShouldShowDualClock - false, isDualClockSet() -false
05-30 12:01:00.035 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/DateView: regionalDateFormat = HH:mm isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.045 2362-2362/? D/SViewCoverClockWidget: initClock() : TimeZone =libcore.util.ZoneInfo[id="Asia/Tehran",mRawOffset=12600000,mEarliestRawOffset=12344000,mUseDst=true,mDstSavings=3600000,transitions=100]
05-30 12:01:00.055 2362-2362/? D/SViewCoverDualClockWidget: setAutoHomeTimezone() - autoHomeTimeZoneId: Asia/Tehran
05-30 12:01:00.055 2362-2362/? D/SecKeyguardStatusUtils: regionalDateFormat = dMy isRTLlanguage = false returnDateFormat = E, d MMMM
05-30 12:01:00.105 2362-2362/? D/SecKeyguardStatusUtils: regionalDateFormat = dMy isRTLlanguage = false returnDateFormat = E, d MMMM


1 ответ

cricket_007 Vaibhav More ответил: 28 апреля 2018 в 11:54

Вы добавляете все параметры в свой URL. У нас есть метод getParams в volley, где вы можете отправить параметры в виде пар ключ-значение.

Обратитесь к этому коду:

private void sendJsonArrayRequestAddOrder(final Context context)
{
    String selectedDate = SelectedDate.split("-")[1].replace(" ","");
    User user = User.getInstance();
    String url = UrlManager.getUrl(this, R.string.AddOrder_url);    final ProgressDialog pDialog;
    pDialog = new ProgressDialog(this);
    pDialog.setMessage("Loading...");
    pDialog.setCancelable(false);
    pDialog.show();    Response.Listener<JSONObject> listener = new Response.Listener<JSONObject>()
    {
        @Override
        public void onResponse(JSONObject response)
        {
            try
            {
                JSONObject orderObj = response;
                String OrderCode = response.getString("OrderCode");            }
            catch (Exception e)
            {
                Log.d("error", e.getMessage());
                e.printStackTrace();
            }
            pDialog.dismiss();        }
    };    Response.ErrorListener errorListener = new Response.ErrorListener()
    {
        @Override
        public void onErrorResponse(VolleyError error)
        {
            error.printStackTrace();
            Toast.makeText(getBaseContext(), "error", Toast.LENGTH_LONG).show();
            pDialog.dismiss();
        }
    };    protected Map<String, String> getParams() {
        Map<String, String> params = new HashMap<String, String>();
  params.put("mobile", user.Mobile);
      params.put("usercarId", SelectedUserCarId);
      params.put("srvIds", SelectedServiceIds);
      params.put("pkgId", SelectedPackageId);
      params.put("ad", SelectedAddress);
      params.put("lat", SelectedLat);
      params.put("lng", SelectedLong);
      params.put("timeId", SelectedTimeId);
      params.put("date", selectedDate);
      params.put("price", String.valueOf((long)Totalprice));      return params;
      }    JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,getParams(), listener, errorListener);
    MyApplication.getInstance().addToRequestQueue(request);
}

Даже если проблема не решена, чем проверка с подключением к серверу или интернету, может быть SocketTimeOutException или Connection Error ошибка отображается в logcat.

milad ответил: 28 апреля 2018 в 10:24
аннотации здесь не допускаются для использования функции getParams () @ akshay-naik
Vaibhav More ответил: 28 апреля 2018 в 10:27
вы можете поместить сообщения logcat, чтобы мы могли видеть, где проблема @milad
milad ответил: 28 апреля 2018 в 10:45
В журнале ничего не видно. только в StackTrace show server error @ ashkay-naik
Vaibhav More ответил: 28 апреля 2018 в 10:55
просто нажмите URL-адрес в веб-браузере, если у вас возникнет какая-либо ошибка, проблема с веб-сайтом, который вы пытаетесь использовать
cricket_007 ответил: 28 апреля 2018 в 11:52
JsonObjectRequest использует третий параметр как JSONObject, а не карту ... И параметр никогда не определяется в этом ответе