以前にも同様のコードを実行したことがありますが、今回はうまくいきません! 理由が本当にわかりません。
何か案は?
public class SingleMenuItemActivity extends Activity {
private static String url = "http://www.tatangalar.com/android/takim_detay.php?takimID=5";
private static final String TAG_MACBILGISI = "son10mac";
private static final String TAG_10 = "10";
private static final String TAG_9 = "9";
JSONArray sonuclar = null;
String filan;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.benim2);
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(url);
try {
sonuclar = json.getJSONArray(TAG_MACBILGISI);
for(int i = 0; i < sonuclar.length(); i++){
JSONObject c = sonuclar.getJSONObject(i);
String s_on = c.getString(TAG_10);
String s_dokuz = c.getString(TAG_9);
filan = s_on;
}
} catch (JSONException e) {
e.printStackTrace();
}
TextView txtsecilen = (TextView) findViewById(R.id.son9);
txtsecilen.setText(filan);
}
}