Asynctask with fragments, Shutting down VM error


I'm trying to use a AsyncTask consulting a parseobject and brings me a picture and text in a list, but when running above shows me the following error:

    10-27 16:29:18.335: D/AndroidRuntime(28453): Shutting down VM
10-27 16:29:18.335: W/dalvikvm(28453): threadid=1: thread exiting with uncaught exception (group=0x40018578)
10-27 16:29:18.343: E/AndroidRuntime(28453): FATAL EXCEPTION: main
10-27 16:29:18.343: E/AndroidRuntime(28453): java.lang.NullPointerException
10-27 16:29:18.343: E/AndroidRuntime(28453):    at com.johanseetlabs.panamaviajero.A_su_alrededor$RemoteDataTask.onPostExecute(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at com.johanseetlabs.panamaviajero.A_su_alrededor$RemoteDataTask.onPostExecute(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at android.os.AsyncTask.finish(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at android.os.AsyncTask.access$300(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at android.os.AsyncTask$InternalHandler.handleMessage(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at android.os.Handler.dispatchMessage(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at android.os.Looper.loop(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at
10-27 16:29:18.343: E/AndroidRuntime(28453):    at java.lang.reflect.Method.invokeNative(Native Method)
10-27 16:29:18.343: E/AndroidRuntime(28453):    at java.lang.reflect.Method.invoke(
10-27 16:29:18.343: E/AndroidRuntime(28453):    at$
10-27 16:29:18.343: E/AndroidRuntime(28453):    at
10-27 16:29:18.343: E/AndroidRuntime(28453):    at dalvik.system.NativeStart.main(Native Method)

My Fragment:

public class A_su_alrededor extends Fragment {
    ListView listview;
    List<ParseObject> ob;
    ProgressDialog mProgressDialog;
    ListViewAdapter adapter;
    public List<ObtenerData> ObtenerDatalist = null;
    View view;
    private WeakReference<RemoteDataTask> asyncTaskWeakRef;

    public void onCreate(Bundle savedInstanceState) {

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.a_su_alrededor, container, false);
        return view;

    // RemoteDataTask AsyncTask
    private class RemoteDataTask extends AsyncTask<Void, Void, Void> {
        private WeakReference<A_su_alrededor> fragmentWeakRef;

        private RemoteDataTask(
                A_su_alrededor a_su_alrededor) {
            this.fragmentWeakRef = new WeakReference<A_su_alrededor>(

        protected void onPreExecute() {
            // Create a progressdialog
            mProgressDialog = new ProgressDialog(getActivity());
            // Set progressdialog title
            // Set progressdialog message
            // Show progressdialog
            // lockScreenOrientation();

        protected Void doInBackground(Void... params) {
            // Create the array
            ObtenerDatalist = new ArrayList<ObtenerData>();
            try {
                ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
                ob = query.find();
                for (ParseObject hotel : ob) {
                    // localizar imagenes en la columna
                    ParseFile image = (ParseFile) hotel.get("image");

                    ObtenerData map = new ObtenerData();
                    map.setHotel((String) hotel.get("hotel"));
            } catch (ParseException e) {
                Log.d("TAG", "AsynTask no se ejecuto");
                Log.e("Error", e.getMessage());
            return null;

        protected void onPostExecute(Void result) {
            // Locate the listview in listview_main.xml
            listview = (ListView) view.findViewById(;
            // Pass the results into
            adapter = new ListViewAdapter(getActivity(), ObtenerDatalist);
            // Binds the Adapter to the ListView
            // Close the progressdialog
            // unlockScreenOrientation();

    private void startNewAsyncTask() {
        RemoteDataTask asyncTask = new RemoteDataTask(this);
        this.asyncTaskWeakRef = new WeakReference<RemoteDataTask>(asyncTask);

The same code is used on a tab, but I decided to delete the tab. The fragment is placed on a FrameLayout from a drawerlayout.

Finally excuse my English.

In the onCreateView method you have this line:

View view = inflater.inflate(R.layout.a_su_alrededor, container, false);

I think you should remove the type name:

view = inflater.inflate(R.layout.a_su_alrededor, container, false);

since at first blush you seem to be using the class-scope reference to the variable named view in the failing onPostExecute method.