通过改造获得的响应,但无法将其存储在变量

时间:2019-04-08 18:44:54

标签: android

即使获得响应,此处的路径行始终存储null

我的java文件是:

   apiInterface1=ApiClient.getClient().create(APIInterface.class);
    Call<List<ComonData>> call = apiInterface1.common();
    call.enqueue(new Callback<List<ComonData>>() {
        @Override
        public void onResponse(Call<List<ComonData>> call, Response<List<ComonData>> response) {
            List<ComonData> body=response.body();
            path=body.get(0).getCityID();
        }

        @Override
        public void onFailure(Call<List<ComonData>> call, Throwable t) {
            Log.d("Tag",t.getMessage() );
        }
    });

我的logcat是:

2019-04-09 00:05:43.084 12316-12316 /? I / AndroidRuntime:VM退出,结果代码为0,清除已跳过。 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:<-200 OK http://192.168.43.196/HomePickerTest/selectcommondata.php(82毫秒) 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:日期:2019年4月8日星期一13:05:43 GMT 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:服务器:Apache / 2.4.33(Win32)OpenSSL / 1.0.2o PHP / 7.0.30 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:X-Powered-By:PHP / 7.0.30 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:内容长度:547 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:保持活动:超时= 5,最大= 100 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:连接:保持活动 2019-04-09 00:05:43.085 12225-12334 /? D / OkHttp:内容类型:text / html;字符集= UTF-8 2019-04-09 00:05:43.088 12225-12334 /? D / OkHttp:[{“ AdID”:“ 1”,“ MemberID”:“ 1”,“ OrganizationName”:“ abcd”,“ Adtype”:“旅馆”,“ CityID”:“ 2”,“ AreaID“:” 7“,”地址“:” hi“,” AdStartDate“:” 9-4-2019“,” AdEndDate“:” 10-4-2019“,” AdShortDescription“:” a“,”状态“ :“非活动”,“付款状态”:“未付款”,“联系号”:“ 1234567890”,“ ShowContactDetails”:“是”,“价格(费用)”:“ 4000”,“照片ID”:“ 1”,“ photoname1” “:” 1“,” photo1“:” 1554740725125(1).jpg“,” photoname2“:” 2“,” photo2“:” AddImage / 1554740725125(2).jpg“,” photoname3“:” 3“, “ photo3”:“ AddImage / 1554740725125(3).jpg”,“ photoname4”:“ 4”,“ photo4”:“ AddImage / 1554740725125(4).jpg”}] 2019-04-09 00:05:43.088 12225-12334 /? D / OkHttp:<-END HTTP(547字节的正文) 2019-04-09 00:05:43.107 555-555 /? I / SFPerfTracer:触发器:(速率:1160:163825)(组成:172:3936)(发布:0:19)(渲染:4:3310)(1:1014486帧)(2:1086629) 2019-04-09 00:05:43.107 555-555 /? D / SFPerfTracer:图层:(4:14)(StatusBar(0xa438f800):2:303479)(com.android.systemui.ImageWallpaper(0xa4583000):2:157020)*(Sprite(0xa43b0000):0:22)*( DimLayerController / Stack = 0(0xa4584400):0:5254)*(动画背景stackId = 1(0xa43b1400):0:1051)*(动画背景stackId = 0(0xa43b3c00):0:18)*(DockedStackDim(0xa4586c00): 0:43)*(NavigationBar(0xa438bc00):2:327)((0xa438d000):2:225)(com.google.android.googlequicksearchbox / com.google.android.launcher.GEL(0xa438e400):2:203) *(com.example.lenovo.homepicker / com.example.lenovo.homepicker.TestImage(0xa492d000):0:58)-(com.android.systemui / com.android.systemui.usb.UsbDebuggingActivity(0xa4585800):0: 51)-(开始com.example.lenovo.homepicker(0xa4390c00):2:35)(com.example.lenovo.homepicker / com.example.lenovo.homepicker.TestImage(0xa43b2800):2:2)* 2019-04-09 00:05:43.123 12225-12225 /? W / art:在Android 4.1之前,方法int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int,boolean)会错误地覆盖android.widget.ListView中的package-private方法 2019-04-09 00:05:43.138 1523-17473 /? I / ActivityManager:进程com.UCMobile.intl(pid 12316)已死 2019-04-09 00:05:43.138 1523-17473 /? D / ActivityManager:cleanUpApplicationRecord-12316 2019-04-09 00:05:43.152 1523-2832 /? I / LaunchCheckinHandler:显示com.example.lenovo.homepicker / .TestImage,cp,ca,1054 2019-04-09 00:05:43.152 1523-2832 /? I / ActivityManager:显示com.example.lenovo.homepicker / .TestImage:+ 1s54ms 2019-04-09 00:05:43.161 11418-11432 /? W / SearchService:中止,客户端分离。 2019-04-09 00:05:43.168 11418-11418 /? I / MicroDetector:保持麦克风打开:false

0 个答案:

没有答案