title: Data won't show on fragment
body: <p>Hey i'm beginner on parsing the data from mysql database using json and volley the problem is the data just want show on fragment and just show few second after that the list was gone, like in this picture <a href="https://i.stack.imgur.com/GFVL9.png" rel="nofollow noreferrer">Trouble Problem</a> and the list data won't get show in fragment which one i want it to be show on the fragments so</p>
  
  <p>This is the code i used for show on fragments</p>
  
  <p><strong>fragment.java</strong></p>
  
  <pre><code>public class KomentarFragment extends Fragment {
  TextView nama,komen;
  View v;
  ArrayList&lt;Komen&gt; kmn = new ArrayList&lt;&gt;();
  public static String url ="http://surveyclickon.000webhostapp.com/android_register_login/komen.php";
  
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View kom =  inflater.inflate(R.layout.fragment_komentar,container,false);
      nama = kom.findViewById(R.id.nm2);
      komen = kom.findViewById(R.id.kmn2);
  
      new AsyncFetch().execute();
  
      return kom;
  }
  
  @Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  }
  
      private class AsyncFetch extends AsyncTask&lt;String, String, String&gt; {
  
      ProgressDialog pDialog = new ProgressDialog(getActivity());
      HttpURLConnection conn;
      URL url = null;
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
  
          pDialog.setMessage("Loading list ...");
          pDialog.setCancelable(false);
          pDialog.show();
      }
  
      @Override
      protected String doInBackground(String... strings) {
          try {
  
              // Enter URL address where your json file resides
              // Even you can make call to php file which returns json data
              url = new URL("http://surveyclickon.000webhostapp.com/android_register_login/back.php");
  
          } catch (MalformedURLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
              return e.toString();
          }
          try {
  
              // Setup HttpURLConnection class to send and receive data from php and mysql
              conn = (HttpURLConnection) url.openConnection();
              conn.setRequestMethod("POST");
  
              // setDoOutput to true as we recieve data from json file
              conn.setDoOutput(true);
  
          } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
              return e1.toString();
          }
          try {
  
              int response_code = conn.getResponseCode();
  
              // Check if successful connection made
              if (response_code == HttpURLConnection.HTTP_OK) {
  
                  // Read data sent from server
                  InputStream input = conn.getInputStream();
                  BufferedReader reader = new BufferedReader(new InputStreamReader(input));
                  StringBuilder result = new StringBuilder();
                  String line;
  
                  while ((line = reader.readLine()) != null) {
                      result.append(line);
                  }
  
                  // Pass data to onPostExecute method
                  return (result.toString());
  
              } else {
  
                  return ("unsuccessful");
              }
  
          } catch (IOException e) {
              e.printStackTrace();
              return e.toString();
          } finally {
              conn.disconnect();
          }
      }
  
      @Override
      protected void onPostExecute(String result) {
          pDialog.dismiss();
  
          try{
              JSONObject object = new JSONObject(result);
              int code = object.getInt("refund");
              if(code == 0) {
                  JSONArray jsonArray = object.getJSONArray("refund");
                  ArrayList&lt;Refund&gt; ref = new ArrayList&lt;&gt;();
                  for (int i = 0; i &lt; jsonArray.length(); i++) {
                      JSONObject jsonObject = jsonArray.getJSONObject(i);
                      Refund refund = new Refund();
                      refund.setNm(jsonObject.getString("nama"));
                      refund.setNo(jsonObject.getString("no"));
                      refund.setAlam(jsonObject.getString("alamat"));
                      refund.setKode(jsonObject.getString("kode"));
                      refund.setAlas(jsonObject.getString("alasan"));
                      ref.add(refund);
                  }
              }
          }catch (JSONException e) {
  
              e.printStackTrace();
              Toast.makeText(getActivity(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
          }
  
      }
  }
  </code></pre>
  
  <p>so how to made the data can be show off on the fragments? so after the storing data on database from database data will be show on the fragments</p>
  
  <p><strong>fragment.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:visibility="visible"&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="15dp"
      android:text="Nama"
      android:textSize="20sp"
      android:textStyle="bold"
      android:id="@+id/nm2" /&gt;
  
  &lt;TextView
      android:id="@+id/kmn2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/nm2"
      android:layout_marginLeft="15dp"
      android:layout_marginTop="10dp"
      android:text="Komentar"
      android:textSize="20sp"
      android:textStyle="bold" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>