title: ListVIew in Fragment Very Laggy
body: <p>I have a ViewPager with 3 fragments. The rightmost fragment has a ListView inside it. The problem is that on two weaker phones I tested this on, it works seemingly smooth and not laggy. However, when I test it on my Note 3, the transition from the middle fragment to this one is very laggy and over 300 frames are skipped according to the logcat. Also, if I lock the phone and then unlock it back onto the ListView it is very laggy to scroll or do anything, unless I swipe left twice to the leftmost fragment. This is my onCreateView, onAttach and onStart methods as well as the adapter below.  </p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
      View view= inflater.inflate(R.layout.fragment_c,container,false);
      mainalyout = (LinearLayout) view.findViewById(R.id.linear_layout_listview);
      listView =  (ListView) view.findViewById(R.id.followed_cities);
      horizontal_scroll = (HorizontalScrollView) view.findViewById(R.id.horizontal_scroll_view);
      swipe = (LinearLayout) view.findViewById(R.id.scroll_up);
      layout =  (LinearLayout) view.findViewById(R.id.scroll_view_layout);
      swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
      return view;
  
  }
  @Override
  public void onAttach(Activity activity) {
      super.onAttach(activity);
      context = MyApp.getContext();
      session = new SessionManager(context);
      userString = session.getUserDetails();
      username = userString.get("username");
      viewPager = (ViewPager) activity.findViewById(R.id.pic_pager);
      parent = (FragmentActivityTesting) activity;
      username = userString.get("username");
      queue = Volley.newRequestQueue(context);
      followed_cities = session.getFollowedCities();
      try {
          citysearcher = (citysearcher) activity;
      } catch(Exception e) {}
      try {
          slideshowready = (slideshowready) activity;
      }catch (Exception e) {}
  
  
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
  
      super.onActivityCreated(savedInstanceState);
  }
  @Override
  public void onStart() {
      super.onStart();
      swipeRefreshLayout.setOnRefreshListener(this);
      if (followed_cities.contains("")) {
          followed_cities.clear();
      }
      if (getActivity().getIntent().getStringExtra("launcher").equals("add")) {
          get_followed(username);
      }
      if (followed_cities.isEmpty()) {
          followed_cities.add(new CityShort("","NONE"));
          ArrayAdapter&lt;CityShort&gt; adapter = new EmptyAdapter();
          adapterr = adapter;
          listView.setAdapter(adapterr);
      }
      else {
          ArrayAdapter&lt;CityShort&gt; adapter = new MyListAdapter();
          adapterr = adapter;
          listView.setAdapter(adapterr);
      }
  </code></pre>
  
  <p>My adapter : </p>
  
  <pre><code>private class MyListAdapter extends ArrayAdapter&lt;CityShort&gt; {
      public MyListAdapter() {
          super(getActivity(), R.layout.followed_item, followed_cities);
  
      }
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          itemView = convertView;
          if (itemView == null) {
              itemView = getActivity().getLayoutInflater().inflate(R.layout.followed_item, parent, false);
          }
          TextView city_name = (TextView) itemView.findViewById(R.id.followed_city_txt);
  
          final String curr_city = followed_cities.get(position).getCityName();
          city_name.setText(curr_city);
          city_name.setTag(followed_cities.get(position).getCityId());
  
          if (curr_city.length() &gt; 15) {
              city_name.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
          }
          listView.setOnTouchListener(swipeDetector);
  
          return itemView;
  
  
      }
      @Override
  
      public int getViewTypeCount() {
  
          return getCount();
      }
  
      @Override
      public int getItemViewType(int position) {
  
          return position;
      }
  }
  </code></pre>