An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| # built application files | |
| *.apk | |
| *.ap_ | |
| # files for the dex VM | |
| *.dex | |
| # Java class files | |
| *.class |
| import android.content.Context; | |
| import android.graphics.Canvas; | |
| import android.graphics.Paint; | |
| import android.text.Layout; | |
| import android.text.StaticLayout; | |
| import android.text.TextPaint; | |
| import android.util.AttributeSet; | |
| import android.widget.TextView; | |
| /** |
| %@ 对象 | |
| %d, %i 整数 | |
| %u 无符整形 | |
| %f 浮点/双字 | |
| %x, %X 二进制整数 | |
| %o 八进制整数 | |
| %zu size_t | |
| %p 指针 | |
| %e 浮点/双字 (科学计算) | |
| %g 浮点/双字 |
| public final class Api { | |
| //region Variables | |
| private static final String API_HOST = Application.string(R.string.api_server); | |
| private static final Object sLockObject = new Object(); | |
| private static Service sService = null; | |
| static final int DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB | |
| //endregion |
| // on error the server sends JSON | |
| /* | |
| { "error": { "data": { "message":"A thing went wrong" } } } | |
| */ | |
| // create model classes.. | |
| public class ErrorResponse { | |
| Error error; | |
| public class FileManager { | |
| private static final String BASE_PATH = "bmreport"; | |
| private static final String IMAGE = "image"; | |
| private static final String TEMP_FILE = "temp_file"; | |
| private static final String LOG = "log"; | |
| private static final String DATA = "data"; | |
| private static final String DEBUG = "debug"; | |
| public static final String APP_CACHE_DIR = "/data/data/your package name/cache"; |
| JSON样例: | |
| {"keshi":"内科","data":[{"name":"心内科"},{"name":"心血管内科"},{"name":"高血压门诊"},{"name":"呼吸科"}],"doctors":[{"name":"徐光","speciality":"内分泌科","keshi":"妇科","level":"主任医生","icon":"icon.png","qr":"abc.png"},{"name":"徐光","speciality":"内分泌科","keshi":"妇科","level":"主任医生","icon":"icon.png","qr":"abc.png"}]} | |
| 校验 http://json.cn/ |
| package com.example.choujiang; | |
| import android.content.Context; | |
| import android.graphics.Canvas; | |
| import android.util.AttributeSet; | |
| import android.view.SurfaceHolder; | |
| import android.view.SurfaceView; | |
| /** | |
| * Created by jingdongqi on 8/22/15. |