How to retrieve data from website to android
<p>I've made a 3 website that share 1 database and already added a JSON php file that works.  These codes worked last time and now I'm having trouble displaying or showing the data from the website in my android app and I dont understand why because I didnt change any of it.  The error is in getNewsfeeds();</p>

<p>Welcome.java</p>

<pre><code>import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.androidquery.AQuery;
import com.androidquery.callback.AjaxCallback;
import com.androidquery.callback.AjaxStatus;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class Welcome extends Activity {
    Button welcome;
    AQuery aq;
    JSONArray articles = new JSONArray();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        getNewsfeeds();
        aq = new AQuery(this);
        welcome = (Button) findViewById(R.id.welcome);

        welcome.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View view) {
                Intent i = new Intent(view.getContext(), NewsFeed.class);
                startActivity(i);

            }

        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.welcome, menu);
        return true;
    }
    public void getNewsfeeds(){
        aq.ajax("http://sillimaninquirer.esy.es/TWS/sidata.php?key=none", JSONObject.class, new AjaxCallback&lt;JSONObject&gt;(){
            @Override
            public void callback(String url, JSONObject jo, AjaxStatus as){
                try {
                    if(jo!=null){
                        articles = jo.getJSONArray("article");
                        Toast.makeText(getBaseContext(), "Articles: "+articles, Toast.LENGTH_SHORT).show();
                    }else{
                        Toast.makeText(getBaseContext(), "Error: No internet connection", Toast.LENGTH_SHORT).show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Manage.setArticles(articles);
            }

        });
    }

}
</code></pre>

<p>NewsFeed.java</p>

<pre><code>import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

public class NewsFeed extends Activity {
    ListView feed_listView;
    EditText search;
    Button t, a, d, c, k;
    JSONArray articles = new JSONArray();
    ArrayList&lt;String&gt; title     = new ArrayList&lt;String&gt;(); 
    ArrayList&lt;String&gt; content   = new ArrayList&lt;String&gt;();  
    ArrayList&lt;String&gt; date      = new ArrayList&lt;String&gt;();  
    ArrayList&lt;String&gt; cpid  = new ArrayList&lt;String&gt;();  

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_feed);

        addArticlesToVar();
        search = (EditText) findViewById(R.id.search);
        feed_listView = (ListView) findViewById(R.id.listView_NewsFeed);

        final Adapter adapter = new Adapter(this,title, content, date,cpid);
        feed_listView.setAdapter(adapter);

        feed_listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

        feed_listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int position, long id) {
                String t = title.get(position);
                String c = content.get(position);
                String d = date.get(position);
                String cat = cpid.get(position);
                Intent i = new Intent(v.getContext(), Article.class);
                i.putExtra("t", t);
                i.putExtra("c", c);
                i.putExtra("d", d);
                i.putExtra("cat", cat);
                startActivity(i);
            }

            @Override
            public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                //Do nothing
            }
        });
        search.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                adapter.getFilter().filter(s.toString());
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count,int after) {
            }

            @Override
            public void afterTextChanged(Editable arg0) {

            }
        });

    }
    public void AddPref(View v){
        Intent i = new Intent(v.getContext(), AddPreference.class);
        startActivity(i);
    }
    public void News(View v){
        Intent i = new Intent(v.getContext(), NewsFeed.class);
        startActivity(i);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.news_feed, menu);
        return true;
    }
    public void addArticlesToVar(){
         articles = Manage.getArticles();
         for(int x=0; x&lt;articles.length(); x++){
             try {
                JSONObject article = articles.getJSONObject(x);
                title.add(article.getString("title"));
                content.add(article.getString("content"));
                date.add(article.getString("pdate"));
                cpid.add(article.getString("cpid"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
         }
     }

}
class Adapter extends ArrayAdapter&lt;String&gt;{
    Context context;
    ArrayList&lt;String&gt; title, content, date, cpid;
    //ArrayList&lt;Articles&gt; art1, art2;

    Adapter (Context context, ArrayList&lt;String&gt; title,ArrayList&lt;String&gt; content, ArrayList&lt;String&gt; date, ArrayList&lt;String&gt;cpid){

        super(context, R.layout.row,R.id.newsfeed_Title, title);
        this.context  = context;
        this.content  = content;
        this.date     = date;
        this.title    = title;
        this.cpid = cpid;

    }
    public View getView(int position, View convertView, ViewGroup parent){
        String t="", c="";
        String tit="", con="";
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View row = layoutInflater.inflate(R.layout.row, parent, false);

        TextView tv_title   = (TextView) row.findViewById(R.id.newsfeed_Title);
        TextView tv_content = (TextView) row.findViewById(R.id.newsfeed_Contentext);
        TextView tv_date    = (TextView) row.findViewById(R.id.newsfeed_date);
        t = title.get(position);
        c = content.get(position);
        for(int tc=0; tc&lt;13; tc++){
            tit+=t.charAt(tc);
        }
        for(int cc=0; cc&lt;30; cc++){
            con+=c.charAt(cc);
        }
        tv_title.setText(tit);
        tv_content.setText(con);
        tv_date.setText("By "+cpid.get(position)+"   "+date.get(position));

        return row;


    }

}
</code></pre>

<p>Manage.java</p>

<pre><code>import org.json.JSONArray;

public class Manage {
    //key=none
    static JSONArray articles = new JSONArray();
    public static void setArticles(JSONArray articles){
        Manage.articles = articles;
    }
    public static JSONArray getArticles(){
        return articles;
    }
}
</code></pre>

<p>row.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" &gt;

    &lt;TextView
        android:id="@+id/newsfeed_Title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Title"
        android:textStyle="bold"
        android:paddingTop="5px"
        android:textAppearance="?android:attr/textAppearanceMedium" /&gt;

    &lt;TextView
        android:id="@+id/newsfeed_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Date"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textSize="18px"
        android:textStyle="bold|italic" /&gt;

    &lt;TextView
        android:id="@+id/newsfeed_Contentext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Contentext" 
        android:paddingTop="5px"
        android:textStyle="italic"
        android:paddingLeft="25px"
        android:textAppearance="?android:attr/textAppearanceSmall" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>LogCat</p>

<pre><code>05-20 05:24:04.035: E/bluestacksHome(9927): Failed to fetch map from web: http://opasanet.appspot.com/op/appmap?id=com.example.sillimaninquirer
05-20 05:24:04.035: E/bluestacksHome(9927): org.json.JSONException: Value &lt;!DOCTYPE of type java.lang.String cannot be converted to JSONObject
05-20 05:24:04.035: E/bluestacksHome(9927):     at org.json.JSON.typeMismatch(JSON.java:111)
05-20 05:24:04.035: E/bluestacksHome(9927):     at org.json.JSONObject.&lt;init&gt;(JSONObject.java:159)
05-20 05:24:04.035: E/bluestacksHome(9927):     at org.json.JSONObject.&lt;init&gt;(JSONObject.java:172)


05-20 05:36:37.145: E/AndroidRuntime(11683): FATAL EXCEPTION: main
05-20 05:36:37.145: E/AndroidRuntime(11683): Process: com.example.sillimaninquirer, PID: 11683
05-20 05:36:37.145: E/AndroidRuntime(11683): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sillimaninquirer/com.example.sillimaninquirer.Welcome}: java.lang.NullPointerException
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.os.Handler.dispatchMessage(Handler.java:102)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.os.Looper.loop(Looper.java:136)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread.main(ActivityThread.java:5021)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at java.lang.reflect.Method.invokeNative(Native Method)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at java.lang.reflect.Method.invoke(Method.java:515)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at dalvik.system.NativeStart.main(Native Method)
05-20 05:36:37.145: E/AndroidRuntime(11683): Caused by: java.lang.NullPointerException
05-20 05:36:37.145: E/AndroidRuntime(11683):    at com.example.sillimaninquirer.Welcome.getSIData(Welcome.java:53)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at com.example.sillimaninquirer.Welcome.onCreate(Welcome.java:29)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.Activity.performCreate(Activity.java:5231)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1090)
05-20 05:36:37.145: E/AndroidRuntime(11683):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-20 05:36:37.145: E/AndroidRuntime(11683):    ... 11 more
</code></pre>