[java] package de.clarisweb.android.jsondemo; import android.os.AsyncTask; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.view.Menu; import android.view.MenuItem; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class MainActivity extends AppCompatActivity { public class DownloadTask extends AsyncTask< String, Void, String> { @Override protected String doInBackground(String… urls) { String result =
Read More
Android: get specific JSON attribute
When accessing http://headers.jsontest.com/ the following content is provided: The Goal is to extract the values for Host and User-Agent. first of all make sure that AndroidManifest.xml contains: Content of MainActivity.java: extract from Logcat shows:
Share this: