title: java.util.ArrayList cannot be cast to myclass - gson
body: <p>I want to use <code>Gson</code> library but I get this error :</p>
  
  <blockquote>
    <p>java.util.ArrayList cannot be cast to <code>UserHelper</code></p>
  </blockquote>
  
  <p>The <code>UserHelper</code> is my class helper:</p>
  
  <pre><code>String user_id="",pass="",show_other_profile="",status="",instagram_link="",
      facebook_link="",google_plus="",telegram_link="",website_link="",birthday="";
  </code></pre>
  
  <hr>
  
  <p>value of <code>str</code> variable :</p>
  
  <pre><code>[{"user_id":"27","pass":"c3992a14e2887f551119b8b72b08fe12","show_other_profile":"","status":"","instagram_link":"","facebook_link":"","google_plus":"","telegram_link":"","website_link":"","birthday":""}]
  </code></pre>
  
  <hr>
  
  <pre><code>UserHelper h = new UserHelper();
  Gson gson = new Gson();
  Type listType = new TypeToken&lt;List&lt;UserHelper&gt;&gt;() {}.getType();
  h = gson.fromJson(res, listType); // error line
  </code></pre>
  
  <hr>
  
  <p><strong>solved</strong></p>
  
  <pre><code>arr_users = gson.fromJson(res, listType);
  h = arr_users.get(0);
  </code></pre>