title: Android Json url if null
body: <p>Wondering if its way to check if the json url is null? by this I mean if url returning null and not json array/objects. </p>
  
  <p>is there some way I can check it? </p>
  
  <p>I have following code and I really wondering how I should do it.</p>
  
  <pre><code>class LoadAllGB extends AsyncTask&lt;String, String, String&gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          mProgressDialog = new ProgressDialog(ListViser.this);
          mProgressDialog.setMessage("Vent Venligst..");
          mProgressDialog.setTitle("Henter");
          mProgressDialog.setIndeterminate(false);
          mProgressDialog.setCancelable(false);
          mProgressDialog.show();
      }
  
      protected String doInBackground(String... args) {
          DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
          String dato = df.format(Calendar.getInstance().getTime());
  
          DateFormat df2 = new SimpleDateFormat("HH");
          String klok = df2.format(Calendar.getInstance().getTime());
  
          String url = "http://192.168.1.15";
          Log.w("leyth",  "Leyth" + url);
          JSONArray json = jParser.getJSONFromUrl(url);
          try {
              //listen tømmes
              for(int i = 0; i &lt; json.length(); i++){
                      JSONObject c = json.getJSONObject(i);
  
                  String time = c.getString(Tag_time);
                  String cover = c.getString(Tag_cover);
                  String artist = c.getString(Tag_artist);
                  String title = c.getString(Tag_title);
  
                  HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                  map.put(Tag_time, time);
                  map.put(Tag_cover, cover);
                  map.put(Tag_artist, artist);
                  map.put(Tag_title, title);
  
                  abcList.add(map);
              }
          } catch (JSONException e) {
              e.printStackTrace();
              Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)",
                         Toast.LENGTH_LONG).show();  
              Log.e("JSON Parser fejl", "fejl da man prøve og hente data " + e.toString());
          }
  
          return null;
      }
  
      protected void onPostExecute(String file_url) { 
  
          if(file_url!=null)//Do your validation for result
          {
              Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)",
                         Toast.LENGTH_LONG).show();  
          }
          if(mProgressDialog.isShowing()){
              mProgressDialog.dismiss();
          }
          // Locate the listview in listview_main.xml
          adapter = new ListViewAdapter(ListViser.this, abcList);
          // Binds the Adapter to the ListView
          listview.setAdapter(adapter);
          registerForContextMenu(listview);
      }
  }
  </code></pre>