weixin_33714884 2016-12-16 14:00 采纳率: 0%
浏览 244

android上的jQuery ajax调用

I have some html and javascript code running on a WIFI module that runs a webserver. At a certain point, a jquery ajax call is done like so:

reqData = JSON.stringify({FileName: L_JSON_FILENAME, CmdArr: [["read", "cmduart", "data"]]});
jQuery.ajax('' + _szFileRequest,
        {
            data: reqData,
            dataType: 'json',
            contentType: "application/json",
            async: false,
            type: 'POST',
            success: function (data, textStatus, jqXHR) {
                ReturnedColumn = handleData(data, textStatus, jqXHR);
            },
            error: function (jqXHR, textStatus, errorThrown)
            {
                ReturnedColumn = "error";
            }
        });

Now I want to do the same thing on an android app.

I am currently working in Android Studio.

I have read something about a JSONobject and using toString. But I have also read about using AsyncHttpClient and using RequestParams.

What is the best way to accomplish this call?

  • 写回答

2条回答 默认 最新

  • weixin_33690963 2016-12-16 14:41
    关注

    I use Retrofit : https://square.github.io/retrofit/ It's perfect to make HTTP calls, and it has converters, to ease conversions from JSON, XML, and other format to java

    Some examples : https://guides.codepath.com/android/Consuming-APIs-with-Retrofit

    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀