title: org.json.JSONException: End of input at character 0 of --- in shared preference android
body: <p>Here is my code. in this I'm retrieving json data stored as string in shared preference.
  but instead I'm getting exception which is below.
   now the thing is I have tried to print out "<code>String fav</code>" 3 times but it just omit that <code>Log.i</code> and doesn't print it. So I can't figure out what is the problem.. Please help me out.. thnx in advance</p>
  
  <pre><code>public class RetriveData {  
  
  static public void savefavRetailer() {
  
      JSONArray jArray = new JSONArray();
      if (Perma.favRetailer.isEmpty()) {
          jArray.put(Perma.followerId);
      } else {
          try {
              for (int i = 0; i &lt; Perma.favRetailer.size(); i++) {
                  jArray.put(Perma.favRetailer.get(i));
              }
              jArray.put(Perma.favRetailer.size(), Perma.followerId);
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
      Perma.editor.putString("favRetailer", jArray.toString());
      Perma.editor.putString("favRetailer " + Perma.followerId, Perma.followerName);
      Perma.editor.commit();
  }
  
  static public void removefavRetailer() {
      Perma.favRetailer.remove(Perma.followerId);
      JSONArray jArray = new JSONArray(Perma.favRetailer);
      Perma.editor.putString("favRetailer", jArray.toString());
      Perma.editor.commit();
  }
  
  
  
  
  static ArrayList&lt;String&gt; getfavRetailer() {
      String fav ;
      Log.i("I getArrayofRetailer", "In");
      Log.i("I getArrayofRetailer", "In");
      fav= Perma.sharedPref.getString("favRetailer", "");
  
      Log.i("REtrive Data fav",""+fav);
      if (fav != null) {
          Log.i("REtrive Data 2ndfav",""+fav);    
          try {
              Log.i("REtrive Data 3rdfav",""+fav);
              JSONArray jArray = new JSONArray(fav);
              for (int i = 0; i &lt; jArray.length(); i++) {
                  String temp = jArray.optString(i);
                  Perma.favRetailer.add(temp);
              }
              Log.i("I getArrayofRetailer", "jArray " + jArray.toString());
          } catch (JSONException e) {
              Log.i("getArrayofRetailer", "Exception");
              e.printStackTrace();
          }
      }
      return Perma.favRetailer;
  }
  
  }
  </code></pre>
  
  <p>Here is log. now in this I'm getting log only three times  ???</p>
  
  <pre><code>04-29 11:11:33.165: I/I getArrayofRetailer(882): In
  04-29 11:11:33.165: I/I getArrayofRetailer(882): In
  04-29 11:11:33.176: I/getArrayofRetailer(882): Exception
  
  04-29 11:11:33.184: W/System.err(882): org.json.JSONException: End of input at  character 0 of 
  04-29 11:11:33.184: W/System.err(882):  at    org.json.JSONTokener.syntaxError(JSONTokener.java:446)
  04-29 11:11:33.194: W/System.err(882):  at org.json.JSONTokener.nextValue(JSONTokener.java:93)
  04-29 11:11:33.194: W/System.err(882):  at org.json.JSONArray.&lt;init&gt;(JSONArray.java:87)
  04-29 11:11:33.194: W/System.err(882):  at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103)
  04-29 11:11:33.194: W/System.err(882):  at rensoft.connectyfinal.RetriveData.getfavRetailer(RetriveData.java:34)
  04-29 11:11:33.194: W/System.err(882):  at rensoft.connectyfinal.Inbox.onCreate(Inbox.java:52)
  04-29 11:11:33.194: W/System.err(882):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-29 11:11:33.214: W/System.err(882):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  04-29 11:11:33.214: W/System.err(882):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  04-29 11:11:33.214: W/System.err(882):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  04-29 11:11:33.214: W/System.err(882):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  04-29 11:11:33.214: W/System.err(882):  at android.os.Handler.dispatchMessage(Handler.java:99)
  04-29 11:11:33.214: W/System.err(882):  at android.os.Looper.loop(Looper.java:123)
  04-29 11:11:33.224: W/System.err(882):  at android.app.ActivityThread.main(ActivityThread.java:3683)
  04-29 11:11:33.224: W/System.err(882):  at java.lang.reflect.Method.invokeNative(Native Method)
  04-29 11:11:33.224: W/System.err(882):  at java.lang.reflect.Method.invoke(Method.java:507)
  04-29 11:11:33.224: W/System.err(882):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  04-29 11:11:33.224: W/System.err(882):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  04-29 11:11:33.234: W/System.err(882):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>