1_database
2_server
-
Use json, import the jar package and copy this content and open the Baidu
Netdisk mobile App, which is more convenient to operate. Extraction code: 3afj
build a folder in the project and paste it into it -
Conversion between json and list:
import com.alibaba.fastjson.JSON;
import java.util.List;
public class JsonListUtil {
/**
* List<T> 转 json字符串
*/
public static <T> String listToJson(List<T> ts) {
return JSON.toJSONString(ts);
}
/**
* json 字符串转 List<T>
*/
public static <T> List<T> jsonToList(String jsonString) {
@SuppressWarnings("unchecked")
List<T> ts = (List<T>) JSON.parse(jsonString);
return ts;
}
}
3_Client
3.1_ Import okhttp dependency
-
Network request protocol:
will be<uses-permission android:name="android.permission.INTERNET" />
added to Manifest.xml
-
Query dependent statement
Enter the okhttp official website and copy the following statement
-
Import dependency
Switch Android to project, open build.gradle under app project to add dependency
-
sync
Note: URL cannot use localhost instead of local ip address