Issue
oooooops :|
why NULL?
server side is fix.
all method is fix.
why NULL? similar code is workd but this code not workd. all logs
is OK.
in fragmet dialog:
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.player_artists_dialog, container, false);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
getDialog().setCancelable(true);
model = this.getArguments().getParcelable("model");
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
listView = (ListView) rootView.findViewById(R.id.listView);
listView.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.VISIBLE);
StringRequest request = new StringRequest(Request.Method.POST,
".. url ..",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getContext(), response, Toast.LENGTH_LONG).show(); // show null
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError ex) {
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("a", String.valueOf(model.getTr()));
params.put("b", String.valueOf(model.getCat()));
return params;
}
};
RequestQueue queue = VolleySingleton.getInstance().getRequestQueue();
queue.add(request);
return rootView;
}
but on this params is worked:
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("a", "104");
params.put("b", "1");
return params;
}
on output LOG is true:
String.valueOf(model.getTr()); // 104 is true
String.valueOf(model.getCat()); // 1 is true
why NULL?????
Solution
use this
String crappyPrefix = "null";
if(result.startsWith(crappyPrefix)){
result = result.substring(crappyPrefix.length(), result.length());
}
JSONObject jo = new JSONObject(result);
Answered By - Santosh Bachkar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.