所以我現在有問題。我想要做的就是獲取json文件中字符串的值。所以這裏實際上是我的api代碼。從JSON Android工作室獲取字符串
String accountnumber = account_no.getText().toString().trim();
String accountname = account_name.getText().toString().trim();
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api-uat.unionbankph.com/uhac/sandbox/accounts/"+accountnumber)
.get()
.addHeader("x-ibm-client-id", "c6243a29-8d78-40ac-9940-5adce3f3cf15")
.addHeader("x-ibm-client-secret", "*********************")
.addHeader("accept", "application/json")
.build();
Response response = client.newCall(request).execute();
我的問題實際上是下一步要從api獲取數據?從API測試,這是JSON結果
[
{
"account_no": "1xxxxxxxxxxxx",
"currency": "PHP",
"account_name": "Richard Real",
"status": "ACTIVE",
"avaiable_balance": "100000.00",
"current_balance": "100000.00"
}
]
我建議你看看Retrofit,GSON,Jackson,OkHttp,RxJava – Seaskyways