title: com.google.gson.internal.LinkedTreeMap cannot be cast
body: <p>I am using retrofit with GSON for the first time.It is Running Fluently with static data but it is showing the above error in the Case of the Dynamic Data.It is Showing error in the Adapter on setting the Text value </p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  
      String Navigation_Url = "http://www.xxxxxxxx.com";
      ListView listView;
      ArrayList&lt;ListPojo&gt; listPojos = new ArrayList&lt;&gt;();
      ListRetrofitAndroid listRetrofitAndroid;
  
  
      ArrayList countries = new ArrayList();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          listView = (ListView) findViewById(R.id.listView);
          getRetrofitData();
      }
  
  
      void getRetrofitData() {
          Retrofit retrofit = new Retrofit.Builder().baseUrl(Navigation_Url).addConverterFactory(GsonConverterFactory.create()).build();
          CountryArrayAPI api = retrofit.create(CountryArrayAPI.class);
          Call&lt;List&gt; call = api.getCountries();
  
  
          call.enqueue(new Callback&lt;List&gt;() {
  
              @Override
              public void onResponse(Call&lt;List&gt; call, Response&lt;List&gt; response) {
                  Gson gson = new Gson();
                  try {
                      listPojos = (ArrayList) response.body();
                      System.out.println("the ArrayList is" + listPojos);
  
  
  //                    ArrayList&lt;ListPojo&gt; merchantOfferModels = gson.fromJson(response, new TypeToken&lt;ListPojo&gt;() {}.getType());
  
  
  
  
  
  
  
  
  
                      listRetrofitAndroid = new ListRetrofitAndroid(getApplicationContext(), listPojos);
                      listView.setAdapter(listRetrofitAndroid);
  
  
                  } catch (Exception e) {
                      Log.d("onResponse", "There is an error");
                      e.printStackTrace();
                  }
  
              }
  
              @Override
              public void onFailure(Call&lt;List&gt; call, Throwable t) {
                  Log.d("Failure", t.toString());
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p><strong>ListRetrofitAndroid(Adapter)</strong></p>
  
  <pre><code>public class ListRetrofitAndroid extends BaseAdapter {
  
      Context mContext;
      ArrayList&lt;ListPojo&gt; arrayList = new ArrayList&lt;&gt;();
      String TAG = "HomeTab_adapter";
  
  
      public ListRetrofitAndroid(Context context, ArrayList&lt;ListPojo&gt; listPojos) {
          super();
          this.mContext = context;
          this.arrayList = listPojos;
  
      }
  
      @Override
      public int getCount() {
  
  
          return arrayList.size();
      }
  
      @Override
      public Object getItem(int position) {
          return arrayList.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          final Holder viewHolder;
  
          if (convertView == null) {
              LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  //            convertView = inflater.inflate(R.layout.list, parent, false);
              convertView = inflater.inflate(R.layout.listview_item, parent, false);
  
              // well set up the ViewHolder
              //  viewHolder = new ClassScheduleStudentAdapter.Holder();
              viewHolder = new Holder();
              viewHolder.textName = convertView.findViewById(R.id.list_item_main);
              convertView.setTag(viewHolder);
  
  
          } else {
  
              viewHolder = (Holder) convertView.getTag();
          }
  
          viewHolder.textName.setText(arrayList.get(position).getTitle());
  
  
          return convertView;
      }
  
      class Holder {
          TextView textName;
      }
  
  
  }
  </code></pre>
  
  <p><strong>model(ListPojo)</strong></p>
  
  <pre><code>public class ListPojo {
  
      String title;
  
      public ListPojo(String title) {
          this.title = title;
      }
  
      public String getTitle() {
          return title;
      }
  }
  </code></pre>
  
  <p><strong>interface</strong></p>
  
  <pre><code>public interface CountryArrayAPI {
      @GET("/api/popular_destinations")
      public Call&lt;List&gt; getCountries();
  }
  </code></pre>
  
  <p><strong>JSON</strong></p>
  
  <pre><code>[
      {
          "id": 1,
          "title": "Hiranya Varna Mahavihar",
          "location": "Kwalakhu Rd, Patan 44600, Nepal",
          "main_image": "images/popular_places/patan-durbar-square.jpg"
      },
      {
          "id": 2,
          "title": "Yasodhar Mahavihar-Bubahal",
          "location": "Jana Bahal Rd, Patan 44600, Nepal",
          "main_image": "images/popular_places/patan-durbar-square.jpg"
      },
      {
          "id": 3,
          "title": "Krishna Temple Sundhara",
          "location": "Tyagal - Lalitpur Rd, Patan 44600, Nepal",
          "main_image": "images/popular_places/Patan-2.jpg"
      },
      {
          "id": 4,
          "title": "Hiranya Varna Mahavihar",
          "location": "Kwalakhu Rd, Patan 44600, Nepal",
          "main_image": "images/popular_places/asd.jpg"
      }
  ]
  </code></pre>
  
  <p><strong>StsckTrace</strong></p>
  
  <pre><code>09-19 05:15:32.475 18949-18949/com.example.user_pc.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                     Process: com.example.user_pc.myapplication, PID: 18949
                                                                                     java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to com.example.user_pc.myapplication.pojo.ListPojo
                                                                                         at com.example.user_pc.myapplication.adpater.ListRetrofitAndroid.getView(ListRetrofitAndroid.java:71)
                                                                                         at android.widget.AbsListView.obtainView(AbsListView.java:2255)
                                                                                         at android.widget.ListView.measureHeightOfChildren(ListView.java:1263)
                                                                                         at android.widget.ListView.onMeasure(ListView.java:1175)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:934)
                                                                                         at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:973)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
                                                                                         at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                                         at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
                                                                                         at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
                                                                                         at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
                                                                                         at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
                                                                                         at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
                                                                                         at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
                                                                                         at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                                         at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
                                                                                         at android.view.View.measure(View.java:16497)
                                                                                         at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
                                                                                         at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
                                                                                         at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
                                                                                         at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
                                                                                         at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
                                                                                         at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
                                                                                         at android.view.Choreographer.doCallbacks(Choreographer.java:574)
                                                                                         at android.view.Choreographer.doFrame(Choreographer.java:544)
                                                                                         at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
                                                                                         at android.os.Handler.handleCallback(Handler.java:733)
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                         at android.os.Looper.loop(Looper.java:136)
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:5001)
                                                                                         at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                         at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
                                                                                         at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>How can this issue be solved?</p>