Tags » DoDo

How can i get JSon data from url on Android?

This is my web page http://ift.tt/1yqyUnk
the json looks like this:

[{“id”:”1″,”name”:”Mihai”,”email”:”mihai@yahoo.com”,”password”:”1234″,”phone”:”765889345″},{“id”:”2″,”name”:”Robin”,”email”:”robin@yahoo.com”,”password”:”1234″,”phone”:”765453434″}]

the code

// Json
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyLog()
            .penaltyDialog()
            .build());

    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
            .penaltyLog()
            .build());
    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork() // or .detectAll() for all detectable problems
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());


    TextView uid = (TextView) findViewById(R.id.titlu_anunt1);
    TextView name1 = (TextView) findViewById(R.id.descriere_anunt1);
    TextView email1 = (TextView) findViewById(R.id.telefon_anunt1);


    JSONObject json = null;
    String str = "";
    HttpResponse response;
    HttpClient myClient = new DefaultHttpClient();
    HttpPost myConnection = new HttpPost("http://ift.tt/1rE2gsq");

    try {
        response = myClient.execute(myConnection);
        str = EntityUtils.toString(response.getEntity(), "UTF-8");

    }
    catch (ClientProtocolException e) {
        e.printStackTrace();
    }
    catch (IOException e) {
        e.printStackTrace();
    }


    try {
        JSONArray jArray = new JSONArray(str);
        json = jArray.getJSONObject(0);


        uid.setText(json.getString("id"));
        name1.setText(json.getString("name"));
        email1.setText(json.getString("email"));


    }
    catch (JSONException e) {
        e.printStackTrace();
    }
… 55 more words
Recent Questions - Stack Overflow

How can i get JSon data from url on Android?

This is my web page http://ift.tt/1yqyUnk
the json looks like this [{“id”:”1″,”titlu”:”vand telefon”,”categoria_id”:”3″,”descriere”:”telefon motorola model2014″,”locatie”:”Oradea”,”user_id”:”1″},{“id”:”2″,”titlu”:”vand golf”,”categoria_id”:”1″,”descriere”:”vand golf an 2001″,”locatie”:”Brasov”,”user_id”:”2″}]

i want to get this data and to show it on my android app , on textviews but i cant get them… 254 more words

Recent Questions - Stack Overflow

Causerie nocturne #2 (Extorsion)

Moi- Bonne nuit, mon amour.

L’Enfant- Bonne nuit, maman. T’es ma meilleure.

Moi- Merci.

L’Enfant- J’vas te donner beaucoup d’argent si t’arrêtes de crier après moi.

——————-

Conversations

The Savages, Part Four

Edal, the guard in the smoke, gets Steven to drop the light-gun, but Dodo escapes with the Doctor while Steven tries to disarm Edal.  Jano, still possessed by the Doctor’s essence, denies releasing the time travelers, and says he’ll lead the patrol after them.  497 more words

First Doctor

The Savages, Part Three

The transfer with the Doctor happens successfully, and Jano, the leader of the city, elects to take the energy transfer himself (instead of divided amongst a group as is ordinary).  370 more words

First Doctor

The most important essay on scholarly publication this week

…is not actually about scholarly publication. It’s Steve Albini’s keynote address at Melbourne’s Face the Music conference. It’s about the music industry, and how the internet transformed it from a restrictive, top-down oligarchy that mostly benefited middlemen into a more open, level, vibrant ecosystem where artists can get worldwide exposure for free, and yet are often compensated better than they were under the old system. 592 more words

Shiny Digital Future