Should I use StringRequest or JsonObjectRequest

I am a little confused as to which I am supposed to use.

The API is an trying to hit accepts regular text post parameters although its response is a JSON String.

Which should I use ?

--------------Solutions-------------

You Can use JSON Object Request for this.

JsonObjectRequest and StringRequest is different in their parent class and their response. You could find it out if you dig into volley's source code.

JsonObjectRequest extends JsonRequest<JSONObject>

StringRequest extends Request<String>

So, if the response is a JSON String, then you could just use JsonObjectRequest for convenience, since Volley has wrapped the response to be a JSONObject.

Category:android Time:2018-10-27 Views:3

Related post

  • When should you use 'friend' in C++? 2008-08-20

    I have been reading through the C++ FAQ and was curious about the friend declaration. I personally have never used it, however I am interested in exploring the language. What is a good example of using friend? Edit: Reading the FAQ a bit longer I lik

  • Which PHP opcode cacher should I use to improve performance? 2008-08-26

    I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use? APC - Installation Guide eAccelerator - Installation Guide XCache - Installation Guide I'm also open to any other alter

  • Should I use Google Web Toolkit for my new webapp? 2008-08-27

    I would like to create a database backed interactive AJAX webapp which has a custom (specific kind of events, editing) calendaring system. This would involve quite a lot of JavaScript and AJAX, and I thought about Google Web Toolkit for the interface

  • When should you use the singleton pattern instead of a static class? 2008-09-05

    Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, e

  • How often should you use git-gc? 2008-09-11

    How often should you use git-gc? The manual page simply says: Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance. Are there some commands to get some

  • Which jQuery plugin should be used to fix the IE6 PNG transparency issue? 2008-09-13

    Is there an IE6/PNG fix that is officially developed by the jQuery team? If not which of the available plugins should I use? --------------Solutions------------- I'm using jquery.pngFix.js. I don't know if it's officially sanctioned or not, I do know

  • Should I use an initialization vector (IV) along with my encryption? 2008-09-15

    Is it recommended that I use an initialization vector to encrypt/decrypt my data? Will it make things more secure? Is it one of those things that need to be evaluated on a case by case basis? To put this into actual context, the Win32 Cryptography fu

  • What datatype should be used for storing phone numbers in SQL Server 2005? 2008-09-16

    I need to store phone numbers in a table. Please suggest which datatype should I use? Wait. Please read on before you hit reply.. This field needs to be indexed heavily as Sales Reps can use this field for searching (including wild character search).

  • What criteria should be used to judge and compare Java applications? 2008-09-17

    I have to support a Java Programming Challenge for students and we have to come up with some technical criteria to judge their java application. What is the best way to compare and judge an application, based on the code and the documentation? Edit t

  • When should I use a struct instead of a class? 2008-09-17

    MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class? Edit: Some people have forgotten that: 1. structs can have methods! 2. structs have no inheritance capabi

  • Should I use haml or erb or erubis for potentially high traffic site? 2008-09-18

    I have been playing with Haml recently and really like the way the resulting code looks to me...the developer. I'm also not too worried about a designer being able to consume or change it...we're a small team. That said, beginning work on a project w

  • What is a smart pointer and when should I use one? 2008-09-20

    What is a smart pointer and when should I use one? --------------Solutions------------- A smart pointer is a class that wraps a "bare" C++ pointer, to manage the lifetime of the object being pointed to. With "bare" C++ pointers, the programmer has to

  • Should I use #define, enum or const? 2008-09-21

    In a C++ project I'm working on, I have a flag kind of value which can have four values. Those four flags can be combined. Flags describe the records in database and can be: new record deleted record modified record existing record Now, for each reco

  • When should I use # and = in ASP.NET controls? 2008-09-22

    I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate. For example: <%= Grid.ClientID %> or <%# Eval("FullName")%> Can someone explain when each should be used so I can keep it straight in my

  • What algorithm should I use to hash passwords into my database? 2008-09-22

    Is there anything available that isn't trivially breakable? --------------Solutions------------- This 2008 answer is now dangerously out of date. SHA (all variants) is now trivially breakable, and best practice is now (as of Jan 2013) to use a key-st

  • When should I use Debug.Assert()? 2008-09-24

    I've been a professional software engineer for about a year now, having graduated with a CS degree. I've known about assertions for a while in C++ and C, but had no idea they existed in C# and .NET at all until recently. Our production code contains

  • What port number should I use when testing connections in my local intranet in .NET? 2008-09-25

    I want to test a connection to a machine in my local intranet. I know the IP address. What port number should I use? 555? BTW: I'm using .NET. --------------Solutions------------- You can use any but avoid the 'well known' port numbers More details o

  • When should I use Inline vs. External Javascript? 2008-09-26

    I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several html pages that need cli

  • When should I use GC.SuppressFinalize()? 2008-09-29

    In .NET, under which circumstances should I use GC.SuppressFinalize()? What advantage(s) does using this method give me? --------------Solutions------------- SuppressFinalize should only be called by a class that has a finalizer. It's informing the G

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.513 (s). 14 q(s)