by
0
106 Views
3 Badges
Top 5% !
Popular
Specified
Popularity: 7913rd place
Created
Modified Feb 2, 2014

Published on:

No tags for this snippet yet.
LanguageJava
SourceGithub

02012014 soru-cevap

02012014 soru-cevap: 
YayinAkisi.java
post this code
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="http://www.snip2code.com/Embed/25811/02012014-soru-cevap?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
package com.example.dene; import org.json.JSONObject; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class YayinAkisi extends Activity { private Button pzt; private Button sal; // url yi çagıralım private static final String url[] = { "http://api.learn2crack.com/android/jsonos/", "http://site.com/pazartesiicinjson", "http://site.com/saliicinjson" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.yayin_akisi); pzt = (Button) findViewById(R.id.button4); pzt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new JSONParse().execute(url[1]); } }); sal = (Button) findViewById(R.id.button5); sal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //url[] dizisinden uygun //olan elemanı çağırırsınız new JSONParse().execute(url[2]); } }); } private class JSONParse extends AsyncTask<String, String, JSONObject> { @Override protected JSONObject doInBackground(String... args) { JSONParser jParser = new JSONParser(); // Getting JSON from URL //parametre olan args, String tipinde bir dizi olarak //geldiğinden args[0] ile ilk elemanını alırız JSONObject json = jParser.getJSONFromUrl(args[0]); return json; } } }
If you want to be updated about similar snippets, Sign in and follow our Channels
Originally posted on https://gist.github.com/8769250