我正在对旧项目进行更新,目前我对Android的知识不多.在项目中,我们有关于产品的评论部分.
为了在发送之前发表评论,我们返回0(一些错误)和1(成功).
以下是我们使用的代码.
final JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Method.POST,
act.getString(R.string.CommentForUserURL),
null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(
JSONObject response) {
Log.d("response done", "done===" + response);
mloading.setVisibility(View.GONE);
if (response != null) {
Comment obj = new Comment();
JSONObject jsonObject = response;
try {
obj.setComment(jsonObject
.getString("Comment"));
Run Code Online (Sandbox Code Playgroud)
现在我们将返回对象从0/1更改为用户对象.
这需要将JsonObjectRequest更新为GJSON请求吗?或者对象也将使用JsonObjectRequest进行解析?
我问,因为当我执行上面的时候,我得到如下错误.
01-25 12:30:21.754: E/Volley(16487): [10114] BasicNetwork.performRequest:
Unexpected response code 500 for
http://new.souqalharim.com/add/CommentForMerchant
Run Code Online (Sandbox Code Playgroud)
知道我为什么会收到这个错误吗?
注意:此URL适用于iPhone应用程序.
这是post方法,所以没有完整的url.还有更多参数要添加,例如:comment = MyComment&userId = 123&productId = 234.因为它是post我不是在实际url中添加参数.
我有其他方法
@Override
protected Map<String, String> getParams()
throws AuthFailureError {
Map<String, …Run Code Online (Sandbox Code Playgroud) 我想做一些像 instagram 应用程序这样的事情,当用户在照片上双击它时,它就像,而他只按一次标签,它会以全屏方式打开