title: Android View Displaying twice
body: <p>This is what I mean by displaying twice.  Both of them are able to scroll depending on where you place your finger.</p>
  
  <p><a href="https://i.stack.imgur.com/lljBK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lljBK.png" alt="enter image description here"></a></p>
  
  <p>I have a basic adapter that doesn't do anything other than load the view (which has some placeholder data seen above).</p>
  
  <p>Here is where the view is referenced in the adapter:</p>
  
  <pre><code>    @Override
  public View newView(Context context, Cursor cursor, ViewGroup parent) {
      View view = LayoutInflater.from(context).inflate(R.layout.list_item_forecast, parent, false);
  
      return view;
  }
  </code></pre>
  
  <p>And the Adapter is call in a fragment here:</p>
  
  <pre><code>    @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  
      mForecastAdapter = new ForecastAdapter(getActivity(), null, 0);
  
  
      ListView forecastListView = (ListView) rootView.findViewById(R.id.listView_forecast);
      forecastListView.setAdapter(mForecastAdapter);
  
      forecastListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView adapterView, View view, int position, long l) {
              // CursorAdapter returns a cursor at the correct position for getItem(), or null
              // if it cannot seek to that position.
              Cursor cursor = (Cursor) adapterView.getItemAtPosition(position);
              if (cursor != null) {
                  String locationSetting = Utility.getPreferredLocation(getActivity());
                  Intent intent = new Intent(getActivity(), DetailActivity.class)
                          .setData(WeatherContract.WeatherEntry.buildWeatherLocationWithDate(
                                  locationSetting, cursor.getLong(COL_WEATHER_DATE)
                          ));
                  startActivity(intent);
              }
          }
      });
  
      return rootView;
  }
  </code></pre>
  
  <p>I also have a cursor loader in that fragment that swaps the cursor onLoadFinished and onLoaderReset.</p>
  
  <p>My layout.xml file, just in case it's relevant.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;!-- Layout for weather forecast list item for future day (not today) --&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="center_vertical"
      android:minHeight="?android:attr/listPreferredItemHeight"
      android:orientation="horizontal"
      android:padding="16dp"&gt;
  
      &lt;ImageView
          android:id="@+id/list_item_icon"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@mipmap/ic_launcher"/&gt;
  
      &lt;LinearLayout
          android:layout_height="wrap_content"
          android:layout_width="0dp"
          android:layout_weight="1"
          android:orientation="vertical"
          android:paddingLeft="16dp"&gt;
  
          &lt;TextView
              android:id="@+id/list_item_date_textview"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Tomorrow"/&gt;
  
          &lt;TextView
              android:id="@+id/list_item_forecast_textview"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Clear"/&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:id="@+id/list_item_high_textview"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="81"/&gt;
  
          &lt;TextView
              android:id="@+id/list_item_low_textview"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="68"/&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Asked for my MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      String LOG_TAG = MainActivity.class.getSimpleName();
  
      private final String FORECASTFRAGMENT_TAG = "FFTAG";
      String mLocation;
  
  
      private void showMap(Uri zipCode){
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setData(zipCode);
  
          if(intent.resolveActivity(this.getPackageManager()) != null){
              startActivity(intent);
          }else{
              View view = getCurrentFocus();
              Snackbar.make(view, "No Map application found", Snackbar.LENGTH_SHORT).setAction("", null).show();
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  //        super.onCreate(savedInstanceState);
  //        setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  //
  //        mLocation = Utility.getPreferredLocation(this);
  //
  //        Log.v(LOG_TAG, "onCreate()");
  
          mLocation = Utility.getPreferredLocation(this);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          if (savedInstanceState == null) {
              getSupportFragmentManager().beginTransaction()
                      .add(R.id.fragment, new ForecastFragment(), FORECASTFRAGMENT_TAG)
                      .commit();
          }
  
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          Log.v(LOG_TAG, "onDestroy()");
      }
  
      @Override
      protected void onStart() {
          super.onStart();
          Log.v(LOG_TAG, "onStart()");
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          if(mLocation != Utility.getPreferredLocation(this)){
              mLocation = Utility.getPreferredLocation(this);
              ForecastFragment ff  = (ForecastFragment)getSupportFragmentManager().findFragmentByTag(FORECASTFRAGMENT_TAG);
              ff.onLocationChange();
          }
          Log.v(LOG_TAG, "onResume()");
      }
  
      @Override
      protected void onStop() {
          super.onStop();
          Log.v(LOG_TAG, "onStop()");
      }
  
      @Override
      protected void onPause() {
          super.onPause();
          Log.v(LOG_TAG, "onPause()");
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
  
          Context context = getApplicationContext();
  //        int duration = Toast.LENGTH_SHORT;
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
  //            Toast toast = Toast.makeText(context, "Settings Pressed", duration);
  //            toast.show();
  
              Intent intent = new Intent(context, SettingsActivity.class);
              startActivity(intent);
  
              return true;
          }else if(id == R.id.action_map_view){
              SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplication());
              String zipCode = preferences.getString(getString(
                      R.string.pref_location_key),
                      getString(R.string.pref_location_default));
  
  
              Uri geolocation = Uri.parse("geo:0,0?").buildUpon()
                      .appendQueryParameter("q", zipCode)
                      .build();
  
              showMap(geolocation);
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>This is the main_activity.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.example.android.sunshine.app.MainActivity"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              app:popupTheme="@style/AppTheme.PopupOverlay" /&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;include layout="@layout/content_main" /&gt;
  
      &lt;!--&lt;android.support.design.widget.FloatingActionButton--&gt;
          &lt;!--android:id="@+id/fab"--&gt;
          &lt;!--android:layout_width="wrap_content"--&gt;
          &lt;!--android:layout_height="wrap_content"--&gt;
          &lt;!--android:layout_gravity="bottom|end"--&gt;
          &lt;!--android:layout_margin="@dimen/fab_margin"--&gt;
          &lt;!--android:src="@android:drawable/ic_dialog_email" /&gt;--&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>And this is the content_main.xml that is referenced:</p>
  
  <pre><code>&lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/fragment"
      android:name="com.example.android.sunshine.app.ForecastFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      tools:layout="@layout/fragment_main" /&gt;
  </code></pre>