I am trying to insert a map object that contains different datatype for "value" option since I have columns with different datatype in database.But I am unable to post this object in database. However I am able to insert data using Arraylist(); in database but I do not know how to use multiple datatypes with that. Here is my code:
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = new Date();
String dated=(dateFormat.format(date));
String Date = dated;
float ENGRO = (float) 10.22;
float AICL = (float) 99.9;
float ACPL = (float) 109.15;
Map<String, Object> map = new HashMap<String, Object>() ;
map.put("Date",dated);
map.put("ENGRO", ENGRO);
map.put("AICL", AICL);
map.put("ACPL", ACPL);
JSONObject json = jsonParser.makeHttpRequest(url_create_product,
"POST", (List<NameValuePair>) map);
// check log cat fro response
Log.d("Create Response", json.toString());
// check for success tag
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// successfully created product
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
// closing this screen
finish();
} else {
// failed to create product
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}