Convert ArrayList To String and Vice Versa Using Gson?

March 25, 2016 , , 0 Comments

ArrayList to String Convert :

String listToJson = new Gson().toJson(historyModelResponse.getResponse().get(i).getHistory());

historyModelResponse.getResponse().get(i).getHistory()= List of Custom Model List

ViceVersa String to get Array List :

Type listType = new TypeToken<List>() {}.getType();

List myModelList = new Gson().fromJson(data.get(i).getHistoryString(), listType);

Contributer

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google

0 comments:

Hot-product

Best Watch Store

Popular Posts

Contact Form

Name

Email *

Message *