Is there any way to convert a normal Java array or ArrayList
to a Json Array in Android to pass the JSON object to a webservice?
Is there any way to convert a normal Java array or ArrayList
to a Json Array in Android to pass the JSON object to a webservice?
如果您想要或需要使用JAVA数组,那么您总是可以使用java.util.Arrays
时实用程序类的静电asList()
方法将您的数组转换为List
.
沿着这些路由的一些东西应该会奏效.
String mStringArray[] = { "String1", "String2" };
JSONArray mJSONArray = new JSONArray(Arrays.asList(mStringArray));
Beware that code is written offhand so consider it pseudo-code.