android Error view php result json on android app

i have a little problem on my app with return result JSon from php.

There is my test.php file on my server :

<?php
mysql_connect("localhost","androidapp","password");
mysql_select_db("androidapp");
$sql=mysql_query("SELECT * FROM ads");
$row=mysql_fetch_assoc($sql);
$output=$row['number'];
$arr = array('number' =>  $output);
print(json_encode($arr));
mysql_close();
?>

When i access my test.php on browser it’s ok, return :

{"number":"261668963"}

And there is my AppMainActivity :

package com.guildap.app;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import android.os.StrictMode;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;

import com.actionbarsherlock.view.MenuItem;
import com.adapter.Categories;
import com.adapter.Podcast;
import com.download.GetStrJson;
import com.general.BasicActivity;
import com.general.Constants;
import com.pjsrnzrpiojdvlz.AdController;
import com.guildap.app.R;

public class AppMainActivity extends BasicActivity {
private AdController myController;
private AdController interstitial;
private Activity act = this;
JSONArray content = null, last = null, top = null;
ListView lvListSidebar;
Button latest, most;

/**
 * class constructor.
 *
 * @since Version 1.0
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    configMenu(true);
    interstitial = new AdController(act, getPubNum("http://myweb/test.php"));
    interstitial.loadAd();
    lvListSidebar = (ListView) findViewById(R.id.lvListSidebar);
    latest = (Button) findViewById(R.id.bttn_latest);
    most = (Button) findViewById(R.id.bttn_most);
    if (checksInternet()) {
        getDataFromApi task = new getDataFromApi();
        task.execute();
    }
 }
/**
 * Creates the category list published and displays the list of the last
 * podcast.
 *
 * @since Version 1.0
 */
public void setDataInList() {
    final ListView lvList = (ListView) findViewById(R.id.lvList);
    Categories adapter = new Categories(this, content);
    lvList.setAdapter(adapter);
    lvList.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view,
                int position, long id) {
            goCateory(position);
        }
    });
    latest.setBackgroundResource(R.drawable.layout_background_sidebar_selected);
    Podcast lastAdapter = new Podcast(this, last);
    lvListSidebar.setAdapter(lastAdapter);
    lvListSidebar.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view,
                int position, long id) {
            goLatestPodcast(position);
        }
    });
}

/**
 * Displays the list of the last podcast.
 *
 * @since Version 1.0
 */
public void setSidebarLast(View v) {
    latest.setBackgroundResource(R.drawable.layout_background_sidebar_selected);
    most.setBackgroundResource(R.drawable.button_selector_sidebar);
    Podcast lastAdapter = new Podcast(this, last);
    lvListSidebar.setAdapter(lastAdapter);
    lvListSidebar.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view,
                int position, long id) {
            goLatestPodcast(position);
        }
    });
}

/**
 * Displays the list of most viewed podcast.
 *
 * @since Version 1.0
 */
public void setSidebarMost(View v) {
    latest.setBackgroundResource(R.drawable.button_selector_sidebar);
    most.setBackgroundResource(R.drawable.layout_background_sidebar_selected);
    Podcast lastAdapter = new Podcast(this, top);
    lvListSidebar.setAdapter(lastAdapter);
    lvListSidebar.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View view,
                int position, long id) {
            goTopPodcast(position);
        }
    });
}

/**
 * Displays the podcast of the selected category.
 *
 * @see com.guildap.app.AppListPodcast.java
 * @since Version 1.0
 */
public void goCateory(int position) {
    try {
        JSONObject element = content.getJSONObject(position);
        int numPodcast = Integer.parseInt(element.getString("podcast"));
        if (numPodcast > 0) {
            Intent intent = new Intent(AppMainActivity.this,
                    AppListPodcast.class);
            String strIdCategory = element.getString("id_categoria");
            intent.putExtra("id_categoria", strIdCategory);
            startActivity(intent);
        } else {
            showAlertDialog(this, getString(R.string.java_alert),
                    getString(R.string.java_not_podcast), true);
        }
    } catch (Exception e) {
        Log.e("Error goCateory", e.toString());
    }
}

/**
 * Displays the selected podcast.
 *
 * @see com.guildap.app.AppPodcast.java
 * @since Version 1.0
 */
public void goLatestPodcast(int position) {
    try {
        JSONObject element = last.getJSONObject(position);
        Intent intent = new Intent(AppMainActivity.this, AppPodcast.class);
        String strId = element.getString("id_podcast");
        intent.putExtra("id_podcast", strId);
        startActivity(intent);
    } catch (Exception e) {
        Log.e("Error goCateory", e.toString());
    }
}

/**
 * Displays the selected podcast.
 *
 * @see com.guildap.app.AppPodcast.java
 * @since Version 1.0
 */
public void goTopPodcast(int position) {
    try {
        JSONObject element = top.getJSONObject(position);
        Intent intent = new Intent(AppMainActivity.this, AppPodcast.class);
        String strId = element.getString("id_podcast");
        intent.putExtra("id_podcast", strId);
        startActivity(intent);
    } catch (Exception e) {
        Log.e("Error goCateory", e.toString());
    }
}

/**
 * Header selection
 *
 * @since Version 1.0
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    String titleMenu = (String) item.getTitle();
    if (titleMenu.equals(getString(R.string.header_refresh))) {
        if (checksInternet()) {
            getDataFromApi task = new getDataFromApi();
            task.execute();
        }
    } else {
        toggle();
    }
    return true;
}

private ProgressDialog dialog;

/**
 * Download the categories available, and the most recent podcast podcast
 * seen.
 *
 * @since Version 1.0
 */
private class getDataFromApi extends AsyncTask<String, String, String> {

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        dialog = new ProgressDialog(AppMainActivity.this);
        String loading = getString(R.string.loading);
        dialog.setMessage(loading);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setProgress(0);
        dialog.show();
        dialog.setCancelable(false);
    }

    @Override
    protected String doInBackground(String... arg0) {
        if (Looper.myLooper() == null) {
            Looper.prepare();
        }
        try {
            System.gc();
            GetStrJson download = new GetStrJson();
            String state = download.downloadJson(Constants.URL_CATEGORIES);
            if (state.equals(Constants.DOWNLOAD_TRUE)) {
                String json = download.getStrJson();
                JSONObject jsonObj = new JSONObject(json);
                int responseCode = download.getIntResponseCode();
                if (responseCode >= 200 && responseCode <= 299) {
                    try {
                        content = jsonObj.getJSONArray("data");
                        downloadSidebarData(download);
                        String idMessage = content.getJSONObject(0)
                                .getString("id_categoria");
                        return Constants.DOWNLOAD_TRUE;
                    } catch (Exception e) {
                        Log.e("Error", e.toString());
                        content = null;
                        return getString(R.string.java_not_content);
                    }
                } else if (responseCode >= 400 && responseCode <= 499) {
                    finish();
                    return responseCodeErrors(responseCode) + ": "
                            + responseCode;
                } else {
                    return responseCodeErrors(responseCode) + ": "
                            + responseCode;
                }
            } else {
                return state;
            }
        } catch (Exception e) {
            Log.e("Error", e.toString());
            return getString(R.string.error);
        }
    }

    protected void onPostExecute(String message) {
        dialog.dismiss();
        dialog = null;
        if (!message.equals(Constants.DOWNLOAD_TRUE)) {
            showMessage(message);
        } else {
            setDataInList();
        }
    }

    public void downloadSidebarData(GetStrJson download) {
        String state = download
                .downloadJson(Constants.URL_GET_LAST_PODCAST);
        try {
            if (state.equals(Constants.DOWNLOAD_TRUE)) {
                String json = download.getStrJson();
                JSONObject jsonObj = new JSONObject(json);
                int responseCode = download.getIntResponseCode();
                if (responseCode >= 200 && responseCode <= 299) {
                    try {
                        last = jsonObj.getJSONArray("data");
                        String idMessage = content.getJSONObject(0)
                                .getString("id_categoria");
                    } catch (Exception e) {
                        Log.e("Error", e.toString());
                        last = null;
                    }
                }
            }
        } catch (Exception e) {
            Log.e("Error", e.toString());
            last = null;
        }
        state = download.downloadJson(Constants.URL_GET_TOP_TEN);
        try {
            if (state.equals(Constants.DOWNLOAD_TRUE)) {
                String json = download.getStrJson();
                JSONObject jsonObj = new JSONObject(json);
                int responseCode = download.getIntResponseCode();
                if (responseCode >= 200 && responseCode <= 299) {
                    try {
                        top = jsonObj.getJSONArray("data");
                        String idMessage = content.getJSONObject(0)
                                .getString("id_categoria");
                    } catch (Exception e) {
                        Log.e("Error", e.toString());
                        top = null;
                    }
                }
            }
        } catch (Exception e) {
            Log.e("Error", e.toString());
            top = null;
        }
    }
}

public String getPubNum(String url) {
    String result ="";
    StringBuilder builder = new StringBuilder();
    HttpClient client = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(url);
    try {
        HttpResponse response = client.execute(httpGet);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (statusCode == 200) {
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
        } else {
            Log.e("", "Failed to download file");
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        JSONObject jsonObject = new JSONObject(builder.toString());

        result = jsonObject.getString("number");

    } catch (JSONException e) {
        e.printStackTrace();
    }

    return result;
}

}

I use this code for ask my php page :

public String getPubNum(String url) {
    String result ="";
    StringBuilder builder = new StringBuilder();
    HttpClient client = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(url);
    try {
        HttpResponse response = client.execute(httpGet);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (statusCode == 200) {
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
        } else {
            Log.e("", "Failed to download file");
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    try {
        JSONObject jsonObject = new JSONObject(builder.toString());

        result = jsonObject.getString("number");

    } catch (JSONException e) {
        e.printStackTrace();
    }

    return result;
}

After the :

setContentView(R.layout.activity_main);

interstitial = new AdController(act, getPubNum("http://myweb.com/test.php"));

When I start my app, it crash instantly.

Can someone take a look on this code?
Maybe I have make mistake somewhere?

The Gemini Effect

Check out this book on Goodreads:
The Gemini Effect

http://www.goodreads.com/book/show/24228189-the-gemini-effect

This book caught my attention only from the title. I’m gonna add this in my reading list. :)

chiboomz xoxo

Alien: Isolation review: The best, most terrifying Alien experience in nearly 30 years

“This is about survival!” a thin, twitchy guy named Axel yelled in my face, and it was at that very moment I knew he was going to die.

And he did. Like some sort of gruesome magic trick, an enormous spike burst out of Axels chest. He looked down at it with probably a great deal more shock than I did. I know the rules. I know you cant say “This is about survival,” in a horror game without an ironic death shortly thereafter.

Apparently Axel wasnt a fan of the genre.

Leave me alone

2014 10 11 00034

Sevastapol station, the scene of the action in Alien: Isolation.

To read this article in full or to leave a comment, please click here

VA – Best Of Female Vocal Trance (2014) [[email protected]] (seed(ów) 46 — leecher(ów) 12)

Info

Artist: VA

Title: Best Of Female Vocal Trance

Year: 2014

Genre: Trance

Duration: 1:14:49

Format / Codec: