title: how can i condense my XML and Java code to make my app run smoother
body: <p>I have made an app that is for my Facebook group. The XML uses a lot of navigation drawers, <code>WebView</code>, <code>ListView</code>  and the Java uses a lot of adapters to run the listviews. what I want to know is there a way of condensing my code to make the app run better. I have added a snippet of the XML and java for you to look at. Any help would be greatly appreciated thanks.</p>
  
  <p>This a bit of the java code it repeats for every array adapter and I have a few as you can see.</p>
  
  <pre><code> ListView CastingAppsDlNav,FireStickDlNav,RootingToolsDlNav,ModdingToolsDlNav,LauncherDlNav,FlimnTvDlNav,ShowBoxDlNav,
              KodiDlNav,LiveTvDlNav,MediaPlayerDlNav,MxPlayerNav,CodecNav,MusicAppNav,MusicDlAppsNav,AnimeNav,TvGuideDlsNav;
  
      ArrayAdapter&lt;String&gt; CastingAdapter,FireStickAdapter,RootingToolAdapter,ModdingToolsAdapter,LauncherAdapter,FilmnTvappAdapter,
              ShowBoxAdapter,KodiDlAdapter,LiveTvAdapter,MediaPlayerAdapter, MxPlayerAdapter, CodecAdapter, MusicAppsAdapter, MusicDlAppsAdapter,
      AnimeAdapter,TvGuidesAdapter;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
          setContentView(R.layout.activity_downloads);
  
          DownloadDrawer = (DrawerLayout) findViewById(R.id.DownloadDrawer);
          SvDownloads = (ScrollView) findViewById(R.id.SvDownloads);
          SvDownloads.setScrollbarFadingEnabled(false);
  
          // Tv Guide Array setup
          TvGuideDlsNav = (ListView) findViewById(R.id.TvGuideDlsNav);
          TvGuideDlsNav.setScrollbarFadingEnabled(false);
  
          String[] TvGuideArray = {"Sky+ Tv Guide", "TvGuide.co.uk","Tv Shows Favs","Tv ShowTimes","HomeScreen"};
          TvGuidesAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,TvGuideArray);
          TvGuideDlsNav.setAdapter(TvGuidesAdapter);
          TvGuideDlsNav.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  switch (position){
                      case 0:
                          //Sky Plus
                          Intent iSkyplusH20 = new Intent(Intent.ACTION_VIEW, Uri.parse(SkyplusplayDl));
                          startActivity(iSkyplusH20);
                          break;
  
                      case 1:
                          //Tvguide.co.uk
                          Intent iTvguidecouk = new Intent(Intent.ACTION_VIEW, Uri.parse(TvGuideUkPlayDl));
                          startActivity(iTvguidecouk);
                          break;
  
                      case 2:
                          //Tv Shows favs
                          Intent iTvshowsFavs = new Intent(Intent.ACTION_VIEW, Uri.parse(TvshowsFavPlayDl));
                          startActivity(iTvshowsFavs);
  
                          break;
  
                      case 3:
                          //Tv Showtimes
                          Intent iTvShowtimes = new Intent(Intent.ACTION_VIEW, Uri.parse(TVShowtimePlayDl));
                          startActivity(iTvShowtimes);
  
                          break;
  
                      case 4:
                          DownloadDrawer.closeDrawer(TvGuideDlsNav);
  
                          break;
  
                  }
              }
          });
  </code></pre>
  
  <p>Next is my XML which is the main reason I want to condense as it massive. </p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.example.harrops.h20droidapp.downloads"
      android:background="@drawable/splashbkground"
      android:id="@+id/DownloadDrawer"&gt;
  
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"&gt;
  
          &lt;ImageView
              android:contentDescription="@string/desc"
              android:background="@drawable/h20logo"
              android:layout_width="fill_parent"
              android:layout_height="80sp"
              android:id="@+id/imageView12"
              android:layout_alignParentTop="true"
              android:layout_centerHorizontal="true"
              android:layout_margin="10dp" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceSmall"
              android:text="H20 Downloads"
              android:id="@+id/textView12"
              android:layout_below="@+id/imageView12"
              android:layout_centerHorizontal="true"
              android:layout_marginTop="40sp"
              android:textColor="#ffffff" /&gt;
  
          &lt;ScrollView
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:id="@+id/SvDownloads"
              android:layout_below="@+id/textView12"
              android:layout_centerHorizontal="true"
              android:layout_marginBottom="10dp"&gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/CastingDl"
              android:id="@+id/bCastingAppsDl"
              android:layout_below="@+id/textView12"
              android:layout_centerHorizontal="true"
              android:layout_marginTop="10sp"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              style="?android:attr/buttonStyleSmall"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/FireStickDl"
              android:id="@+id/bFireStickDl"
              android:layout_below="@+id/bCastingAppsDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/RootingDl"
              android:id="@+id/bRootingToolsDl"
              android:layout_below="@+id/bFireStickDl"
              android:layout_centerHorizontal="true"
              android:textSize="20dp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/ModdingDl"
              android:id="@+id/bModdingToolsDl"
              android:layout_below="@+id/bRootingToolsDl"
              android:layout_centerHorizontal="true"
              android:textSize="20dp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/LauncherDl"
              android:id="@+id/bLauncherAppDl"
              android:layout_below="@+id/bRootingToolsDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/FilmnTvDl"
              android:id="@+id/bFilmnTvDl"
              android:layout_below="@+id/bLauncherAppDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/LiveTvDl"
              android:id="@+id/bLiveTvDl"
              android:layout_below="@+id/bFilmnTvDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/MediaplayerDl"
              android:id="@+id/bMediaPlayerDl"
              android:layout_below="@+id/bLiveTvDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
          &lt;Button
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="Anime Apps"
              android:id="@+id/bAnimeDl"
              android:layout_below="@+id/bMediaPlayerDl"
              android:layout_centerHorizontal="true"
              android:textSize="20sp"
              android:background="#4b48ac"
              android:layout_marginTop="10sp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp" /&gt;
  
                  &lt;Button
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/MusicAppsDl"
                      android:id="@+id/bMusicApps"
                      android:layout_below="@+id/bAnimeDl"
                      android:layout_centerHorizontal="true"
                      android:textSize="20sp"
                      android:background="#4b48ac"
                      android:layout_marginTop="10sp"
                      android:layout_marginLeft="10dp"
                      android:layout_marginRight="10dp" /&gt;
  
  
                  &lt;Button
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:text="Tv Guides"
                      android:id="@+id/bTvGuideDl"
                      android:layout_below="@+id/bMusicApps"
                      android:layout_centerHorizontal="true"
                      android:textSize="20sp"
                      android:background="#4b48ac"
                      android:layout_marginTop="10sp"
                      android:layout_marginLeft="10dp"
                      android:layout_marginRight="10dp" /&gt;
  
                  &lt;Button
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:text="@string/homescreenDl"
                      android:id="@+id/bHomescreenDl"
                      android:layout_below="@+id/bMusicApps"
                      android:layout_centerHorizontal="true"
                      android:textSize="20sp"
                      android:background="#4b48ac"
                      android:layout_marginTop="10sp"
                      android:layout_marginLeft="10dp"
                      android:layout_marginRight="10dp" /&gt;
  
  
              &lt;/LinearLayout&gt;
          &lt;/ScrollView&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/CastingAppsDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/FireStickDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/RootingToolsDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/ModdingToolsDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/LauncherDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/FlimnTvDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/LiveTvDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/MediaPlayerDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/MusicAppNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/MemeAppDlNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/ShowBoxDlNav"
          android:background="#4b48ac"
          android:layout_gravity="end"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/KodiDlNav"
          android:background="#4b48ac"
          android:layout_gravity="end"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/MxPlayerNav"
          android:background="#4b48ac"
          android:layout_gravity="end"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/MusicDlAppsNav"
          android:background="#4b48ac"
          android:layout_gravity="end"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/CodecNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/AnimeNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
          &lt;/ListView&gt;
  
      &lt;ListView
          android:layout_width="200sp"
          android:layout_height="fill_parent"
          android:id="@+id/TvGuideDlsNav"
          android:background="#4b48ac"
          android:layout_gravity="start"
          &gt;
  
      &lt;/ListView&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>