Volley Post API以字符串形式返回结果

时间:2019-05-19 15:28:22

标签: android

当我使用参数(URL和prams)调用函数时,在主活动的结果内部未返回登录名。 其返回null,然后实现烤面包,然后继续执行我的功能。

请提供帮助以使该功能成为实现中的第一个

promisefunction()
.then((resolve, reject) => {
if (reject)
{
 agent.add("I am sorry for the inconvenience but an error happened during your last call.");
 agent.add("Please try in a while");
}
else
agent.add("SUCCESS");
}

1 个答案:

答案 0 :(得分:0)

Volley不会返回值,您需要检查其他方法,例如直接在要从API获取响应的函数中显示敬酒,如下所述:

new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {

Toast.makeText(MainActivity.this,response,Toast.LENGTH_LONG).show();
                        myresponse =response;
**/////get all the data here and show that into the response.**
                    }
                },