title: refresh json view is not work after update sdk 24
body: <p>After switching to sdk24, I have a problem.
  read json php application, but no longer updated. You must give closure forces her to reread.
  before I used to refresh and update listfragment perfect. not now.
  I give I add new information is added to the database, or you can delete, but the application does not update.</p>
  
  <p>code json reader + inserd + deleted + refresh:</p>
  
  <pre><code>   public class playlist_torrent extends ListFragment {
  
      Main2Activity activity= (Main2Activity) getActivity();
  
  
      private ProgressDialog pDialog;
  
      // URL to get contacts JSON
      private static String url = "http://vrt.ro/remote/index-torrent.php?token=";
  
      // JSON Node names
      private static final String TAG_ID = "id";
      private static final String TAG_NAME = "name";
      private static final String TAG_IMAGE = "image";
      private static final String TAG_ADDRESS = "address";
  
      String POPUP_LOGIN_TITLE;
      String POPUP_LOGIN_TEXT;
      String EMAIL_HINT;
      String PASSWORD_HINT;
  
      // contacts JSONArray
      JSONArray contacts = null;
  
      // Hashmap for ListView
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.activity_playlist_torrent, container, false);
  
  
          POPUP_LOGIN_TITLE=getActivity().getString(R.string.text_titlu_insert_stream_playlist);
          POPUP_LOGIN_TEXT=getActivity().getString(R.string.text_completeaza_datele);
          EMAIL_HINT=getActivity().getString(R.string.name_torrent);
          PASSWORD_HINT=getActivity().getString(R.string.magnet_torrent);
          final FloatingActionButton actionA = (FloatingActionButton) v.findViewById(R.id.action_a);
          actionA.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(final View view) {
                  actionA.setTitle(getActivity().getString(R.string.text_add_new_url));
  
  
                  AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
  
                  alert.setTitle(POPUP_LOGIN_TITLE);
                  alert.setMessage(POPUP_LOGIN_TEXT);
  
                  // Set an EditText view to get user input
                  final EditText name = new EditText(getActivity());
                  name.setHint(EMAIL_HINT);
  
                  final EditText url_streaming = new EditText(getActivity());
                  url_streaming.setHint(PASSWORD_HINT);
  
  
  
  
                  LinearLayout layout = new LinearLayout(getActivity().getApplicationContext());
                  layout.setOrientation(LinearLayout.VERTICAL);
                  layout.addView(name);
                  layout.addView(url_streaming);
                  alert.setView(layout);
  
                  alert.setPositiveButton(getActivity().getString(R.string.ok), new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
  
  
                          if (url_streaming.getText().toString().compareToIgnoreCase("") == 0) {
                              Snackbar.make(view, R.string.error_url_emty_playlist, Snackbar.LENGTH_LONG).show();
                              return;
                          }
  
                          new Thread() {
  
                              public void run() {
  
                                  try {
  
                                      HttpURLConnection.setFollowRedirects(false);
                                      // note : you may also need
                                      //HttpURLConnection.setInstanceFollowRedirects(false)
                                      Bundle args = getArguments();
                                      String token = args.getString("token");
                                      String name_streaming = name.getText().toString();
                                      String Url_streaming = url_streaming.getText().toString();
                                      HttpURLConnection con =  (HttpURLConnection) new URL("http://vrt.ro/remote/insert-torrent.php?token="+token+"&amp;nume="+name_streaming+"&amp;url="+Url_streaming).openConnection();
                                      con.setRequestMethod("HEAD");
                                      if(con.getResponseCode() == HttpURLConnection.HTTP_OK) {
  
  
                                          FragmentTransaction ft = getFragmentManager().beginTransaction();
                                          ft.detach(playlist_torrent.this).attach(playlist_torrent.this).commit();
  
  
  // Reload current fragment
  
  
  
                                      }
                                      else{
  
                                      }
                                  }
                                  catch (Exception e) {
                                      e.printStackTrace();
                                  }
                              }
                          }.start();
                      }
                  });
  
                  alert.setNegativeButton(getActivity().getString(R.string.cancel), new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int whichButton) {
                          // Canceled.
                      }
                  });
  
                  alert.show();
              }
          });
          final FloatingActionButton actionB = (FloatingActionButton) v.findViewById(R.id.action_b);
          actionB.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  actionB.setTitle(getActivity().getString(R.string.refresh_done));
                  FragmentTransaction ft = getFragmentManager().beginTransaction();
                  ft.detach(playlist_torrent.this).attach(playlist_torrent.this).commit();
              }
          });
  
  
          return v;
      }
      @Override
      public void onViewCreated (View view, Bundle savedInstanceState) {
  
          contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
          ListView lv = getListView();
  
          // Listview on item click listener
          lv.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, final View view,
                                      int position, long id) {
                  // getting values from selected ListItem
  
                  final String description = ((TextView) view.findViewById(R.id.mobile)).getText().toString();
  
                  final String id_stream = ((TextView) view.findViewById(R.id.id_streaming)).getText().toString();
  
                  // Starting single contact activity
  
                  AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle);
                  builder.setTitle("Select");
                  // builder.setMessage("Lorem ipsum dolor ....");
                  builder.setItems(new CharSequence[]
                                  {getString(R.string.play_video), getString(R.string.remove_video)},
                          new DialogInterface.OnClickListener() {
                              public void onClick(DialogInterface dialog, int which) {
                                  // The 'which' argument contains the index position
                                  // of the selected item
                                  switch (which) {
                                      case 0:
  
                                          TorrentPlayerFragment fragment3 = new TorrentPlayerFragment();
                                          fragment3.onDestroyView();
                                          FragmentTransaction fragmentTransaction3 = getFragmentManager().beginTransaction();
                                          Bundle args = new Bundle();
                                          args.putString("url", description);
                                          fragment3.setArguments(args);
                                          fragmentTransaction3.addToBackStack(null);
                                          //getFragmentManager().popBackStack();
                                          fragmentTransaction3.remove(fragment3);
                                          fragmentTransaction3.replace(R.id.frame,fragment3);
                                          fragmentTransaction3.commit();
  
  //----
                                          break;
                                      case 1:
                                          // Snack Bar
                                          Snackbar bar = Snackbar.make(view, R.string.confirm_delete_playlist, Snackbar.LENGTH_LONG)
                                                  .setAction(R.string.yes, new View.OnClickListener() {
                                                      @Override
                                                      public void onClick(View v) {
  
                                                          // ---Control remote api---
                                                          new Thread() {
  
                                                              public void run() {
  
                                                                  try {
                                                                      HttpURLConnection.setFollowRedirects(false);
                                                                      // note : you may also need
                                                                      //HttpURLConnection.setInstanceFollowRedirects(false)
  
                                                                      HttpURLConnection con =  (HttpURLConnection) new URL("http://vrt.ro/remote/delete-torrent.php?id="+id_stream).openConnection();
                                                                      con.setRequestMethod("HEAD");
                                                                      if(con.getResponseCode() == HttpURLConnection.HTTP_OK) {
  
                                                                          //--refresh fragment
                                                                          FragmentTransaction ft = getFragmentManager().beginTransaction();
                                                                          ft.detach(playlist_torrent.this).attach(playlist_torrent.this).commit();
                                                                          //Fin refresh fragment
  
                                                                          // startActivity(getIntent());
                                                                          // finish();
  
                                                   /*       final Handler handler = new Handler();
                                                          Runnable refresh = new Runnable() {
                                                              @Override
                                                              public void run() {
                                                                  new onPreExecute().execute();
                                                                  handler.postDelayed(this, 60 * 1000);
                                                              }
                                                          };
                                                          handler.postDelayed(refresh, 60 * 1000);     */
                                                                      }
                                                                      else{
  
                                                                      }
                                                                  }
                                                                  catch (Exception e) {
                                                                      e.printStackTrace();
                                                                  }
                                                              }
                                                          }.start();
                                                          // ----fin Control remote api----
                                                      }
                                                  });
  
                                          bar.show();
  
  
                                          break;
                                  }
                              }
                          });
                  builder.create().show();
  
              }
          });
  
          // Calling async task to get json
          new GetContacts().execute();
  
      }
      public static void createDirectory(File dir) throws IllegalStateException{
          if (!dir.exists()){
              if(!dir.mkdirs()){
                  throw new IllegalStateException(
                          "Check if you've added permissions in AndroidManifest.xml: \n" +
                                  "&lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/&gt; \n"
                  );
              }
          }
      }
      /**
       * Async task class to get json by making HTTP call
       *
       * */
  
  
      private class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              // Showing progress dialog
              pDialog = new ProgressDialog(getActivity());
              pDialog.setMessage("Please wait...");
              pDialog.setCancelable(false);
              pDialog.show();
  
          }
  
          @Override
          protected Void doInBackground(Void... arg0) {
              // Creating service handler class instance
              ServiceHandler sh = new ServiceHandler();
  
              // Bundle bundle = getActivity().getIntent().getExtras();
              //String token = bundle.getString("id");
              Bundle args = getArguments();
              String myString = args.getString("token");
  
              // Making a request to url and getting response
              String jsonStr = sh.makeServiceCall(url+myString, ServiceHandler.GET);
  
              Log.d("Response: ", "&gt; " + jsonStr);
  
              if (jsonStr != null) {
                  try {
                      JSONObject jsonObj = new JSONObject(jsonStr);
  
                      // Getting JSON Array node
                      contacts = jsonObj.getJSONArray(myString);
  
                      // looping through All Contacts
                      for (int i = 0; i &lt; contacts.length(); i++) {
                          JSONObject c = contacts.getJSONObject(i);
  
                          String id = c.getString(TAG_ID);
                          String name = c.getString(TAG_NAME);
                          String image = c.getString(TAG_IMAGE);
                          String address = c.getString(TAG_ADDRESS);
  
  
                          // tmp hashmap for single contact
                          HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;();
  
                          // adding each child node to HashMap key =&gt; value
                          contact.put(TAG_ID, id);
                          contact.put(TAG_NAME, name);
                          contact.put(TAG_IMAGE, image);
                          contact.put(TAG_ADDRESS, address);
  
                          // adding contact to contact list
                          contactList.add(contact);
                      }
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              } else {
                  Log.e("ServiceHandler", "Couldn't get any data from the url");
              }
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
              // Dismiss the progress dialog
              if (pDialog.isShowing())
                  pDialog.dismiss();
              /**
               * Updating parsed JSON data into ListView
               * */
  
  
  
              ListAdapter adapter = new SimpleAdapter(
  
  
  
                      getActivity(), contactList,
                      R.layout.list_item, new String[]{TAG_NAME, TAG_ID,
                      TAG_ADDRESS}, new int[]{R.id.name,  R.id.id_streaming, R.id.mobile});
  
  
  
              setListAdapter(adapter);
          }
  
  
      }
  }
  </code></pre>
  
  <p>This is the code from refresh:</p>
  
  <pre><code>                                                                        //--refresh fragment
                                                                      FragmentTransaction ft = getFragmentManager().beginTransaction();
                                                                      ft.detach(playlist_torrent.this).attach(playlist_torrent.this).commit();
                                                                      //Fin refresh fragment
  </code></pre>
  
  <p>please help. thank you.</p>
  
  <p>Edit:</p>
  
  <p>if you leave an interval of a few minutes and refresh it goes. but only one time. as if the connection remains open and no longer responds.</p>