【发布时间】:2016-09-22 11:11:45
【问题描述】:
//global
getDatabaseChart();
addData();
public void addData() {
int a;
a = profile.getTotalBelum();
Log.d("AA",""+a);
final float[] yData = {a};
......
}
public void getDatabaseChart(){
//Creating a string request
Log.d("MasukTak","MasukTak");
StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.URL_WEB + "a.php",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// hidePDialog();
try {
Log.d("TgkSini", response);
JSONObject json = new JSONObject(response);
int success = json.getInt("success");
if (success == 1) {
user = json.getJSONArray("user");
for (int i = 0; i < user.length(); i++) {
JSONObject obj = user.getJSONObject(i);
profile = new ProfileUser();
profile.setTotalBelum(obj.getInt("belum"));
Log.d("BelumB",String.valueOf(profile.getTotalBelum()));
}
abc = profile.getTotalBelum();
Log.d("abccc", String.valueOf(abc));
} else {
Log.d("data2 ", "no user");
} ...............
这是我的代码 .. 现在我更改代码 .. 我只是直接整数值 .. 当我看到 logcat .. 检查 log.d abccc .. abc = 2 的值 ... 然后我检查 log.d AA 值对于 a = 0 ...
如何解决?请帮帮我。
【问题讨论】:
-
我刚刚编译了你的代码,它工作正常。你能检查出错误发生在哪一行吗?
-
不要只记录
a,记录所有并发布完整的stracktrace! -
@NecipAllef ...是的,它工作正常,但我得到的值不一样.. huhu
标签: android arrays string integer