bursa escort bursa escort beylikdüzü escort escort bayan afyon escort escort bayan istanbul escort mersin escort bayan escort kayseri bursa escort escort kayseri bursa escort banko tahmin meyve siparişi bursa escort bursa escort
String s = "http://www.testandroid.com/getfiles";
URL urls;

try {
urls = new URL(s);
URLConnection tc = urls.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(tc.getInputStream()));
String line;
while ((line = in.readLine()) != null) {

//JSON dan gelen ifade array ise bu sekilde kullanilir
JSONArray ja = new JSONArray(line);
for (int i = 0; i < ja.length(); i++) {
JSONObject c = ja.getJSONObject(i);
String fileName = c.getString("FileName");
String fileDate = c.getString("FileDate");
Dosya doc = new Dosya(fileName, fileDate);
flList.add(doc);
}

// JSON dan tek bir satır geliyorsa kullanım şekli aşağıdaki gibidir.

JSONObject c =new  JSONObject("columnName");
}
}
catch (Exception e) {

}

Yazar : Emrah Kahraman

Bilgisayar Mühendisi

“Android JSON Kullanımı” için 3 Yorum

  1. Mary dedi ki:

    cuttle sagt:Hi jogep, thanks for your reply.My error codes are as foonlwilg:-private String filters;public void setFilters(String filters) {this.filters = filters;} . .public String execute() throws Exception {if (this.filters != null) {System.out.println( filters = + this.filters);jsonFilter = (JSONObject) JSONSerializer.toJSON(this.filters); //< (the codes below this line never run.)System.out.println("after Json 1");groupOp = jsonFilter.getString("groupOp");System.out.println("groupOp :" + groupOp);rules = jsonFilter.getJSONArray("rules");rulesCount = JSONArray.getDimensions(rules)[0];System.out.println("rulesCount = " + rulesCount);}System.out.println("after Json 2");return SUCCESS;}The filter String is: {"groupOp":"AND","rules":[{"field":"remark","op":"bw","data":"test"}]}Thank you!

  2. Emrah Kahraman dedi ki:

    List params = new ArrayList();
    JSONArray rules = null;
    JSONObject json = jsonParser.makeHttpRequest(“http://www.emrahkahraman.com.tr/mary.json”, “GET”,
    params);
    try {
    rules = json.getJSONArray(“rules”);
    int rulesCount=rules.length();
    String groupOp = json.getString(“groupOp”);
    for (int i = 0; i < rules.length(); i++) { JSONObject c = rules.getJSONObject(i); String field = c.getString("field"); String op = c.getString("op"); String data = c.getString("data"); }

  3. Emrah Kahraman dedi ki:

    JSONArray rules = null;
    String filters=”{\”groupOp\”:\”AND\”,\”rules\”:[{\”field\”:\”remark\”,\”op\”:\”bw\”,\”data\”:\”test\”}]}”;
    JSONObject json = null;
    try {
    json = new JSONObject(filters);
    } catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    }
    try {
    rules = json.getJSONArray(“rules”);
    int rulesCount=rules.length();
    String groupOp = json.getString(“groupOp”);
    for (int i = 0; i < rules.length(); i++) { JSONObject c = rules.getJSONObject(i); String field = c.getString("field"); String op = c.getString("op"); String data = c.getString("data"); }

Android JSON Kullanımı Yazısı için Yorum Yapabilirsiniz

Kan Bağışı
Reklam Panosu
Gurme

Reklam Panosu
Bağlantılar