I am attempting to add some Book(title, author, year)
into my book
table in a server using an AsyncTask
, but i am getting missing bookobject as JSON
from the method addBook
(from the server). So i made a bookObject
like this:
JSONObject jObj = new JSONObject();
jObj.put("title", "JAVA");
jObj.put("author", "me");
jObj.put("year", 2005);
After that, i wanna use(my intention is to send this book Object
):
List<NameValuePair> nameValuePairs = new ArrayList<>(1);
nameValuePairs.add(new BasicNameValuePair(jObj)); //Error
new AaaBookAsyncTask(this).execute(new Pair<>(nameValuePairs, httpClient));
The problem is BasicNameValuePair
cannot applied to JSONObject
, but now how can i send the book Object
? - Any help or hints is very appreciated.Thanks, Carl