// Path: Networking/app/src/main/java/qa/edu/qu/cse/cmps312/networking/Consts/Consts.java
// public class Consts {
//     // Get your user name at http://www.geonames.org/login
//     public static final String USERNAME = "insert_username";
//     public static final String URL = "http://api.geonames.org/earthquakesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=";
//     public static final String URLXML = "http://api.geonames.org/earthquakes?north=44.1&south=-9.9&east=-22.4&west=55.2&username=";
// }


import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import qa.edu.qu.cse.cmps312.networking.Consts.Consts;
            } catch (InterruptedException e) {
                Log.e(TAG, "InterruptedException occured");
            } catch (MalformedURLException exception) {
                Log.e(TAG, "MalformedURLException");
            } catch (IOException exception) {
                Log.e(TAG, "IOException");
            } finally {
                if (httpUrlConnection != null)
                    httpUrlConnection.disconnect();
            }

            return null;
        }

        @Override
        protected void onPostExecute(List<String> result) {
            if (result != null) {
                mTextview.setVisibility(View.GONE);
                mProgressBar.setVisibility(View.GONE);
                mListView.setVisibility(View.VISIBLE);
                mListView.setAdapter(new ArrayAdapter<String>(
                        NetworkingXMLActivity.this,
                        android.R.layout.simple_list_item_1, result));
            } else {
                new AlertDialog.Builder(NetworkingXMLActivity.this).setTitle(R.string.error)
                        .setMessage(R.string.xml_error)
                        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                NetworkingXMLActivity.this.finish();
// Path: Networking/app/src/main/java/qa/edu/qu/cse/cmps312/networking/Consts/Consts.java
// public class Consts {
//     // Get your user name at http://www.geonames.org/login
//     public static final String USERNAME = "insert_username";
//     public static final String URL = "http://api.geonames.org/earthquakesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=";
//     public static final String URLXML = "http://api.geonames.org/earthquakes?north=44.1&south=-9.9&east=-22.4&west=55.2&username=";
// }


// Path: Networking/app/src/main/java/qa/edu/qu/cse/cmps312/networking/NetworkingXMLActivity.java
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import qa.edu.qu.cse.cmps312.networking.Consts.Consts;

            } catch (InterruptedException e) {
                Log.e(TAG, "InterruptedException occured");
            } catch (MalformedURLException exception) {
                Log.e(TAG, "MalformedURLException");
            } catch (IOException exception) {
                Log.e(TAG, "IOException");
            } finally {
                if (httpUrlConnection != null)
                    httpUrlConnection.disconnect();
            }

            return null;
        }

        @Override
        protected void onPostExecute(List<String> result) {
            if (result != null) {
                mTextview.setVisibility(View.GONE);
                mProgressBar.setVisibility(View.GONE);
                mListView.setVisibility(View.VISIBLE);
                mListView.setAdapter(new ArrayAdapter<String>(
                        NetworkingXMLActivity.this,
                        android.R.layout.simple_list_item_1, result));
            } else {
                new AlertDialog.Builder(NetworkingXMLActivity.this).setTitle(R.string.error)
                        .setMessage(R.string.xml_error)
                        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                NetworkingXMLActivity.this.finish();
                                dialog.dismiss();