XML : How to implement a new page in Android and return results( Able to hit back button)

Currently the method Im using right now(Which I feel is really sloppy) is calling this on a function called when the button is clicked through xml

  setContentView(R.layout.selectcontacts);    

Which for some reason bugs the navigation bar to white rather than what is what one the previous page(blue)

XML layout for select contacts:

  <RelativeLayout 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"      android:descendantFocusability="blocksDescendants">        <android.support.design.widget.AppBarLayout          android:layout_width="match_parent"          android:layout_height="wrap_content"          android:theme="@style/AppTheme.AppBarOverlay"          android:id="@+id/view2">        <android.support.v7.widget.Toolbar          android:id="@+id/thetoolbar"          android:layout_width="match_parent"          android:layout_height="?attr/actionBarSize"          android:background="?attr/colorPrimary"          app:popupTheme="@style/AppTheme.PopupOverlay"/>  </android.support.design.widget.AppBarLayout>        <ListView  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:cacheColorHint="@android:color/transparent"  android:divider="@android:drawable/divider_horizontal_textfield"  android:dividerHeight="2dp"  android:paddingBottom="8dp"  android:paddingTop="15dp"  android:id="@+id/contactlistview"      android:layout_alignParentLeft="true"  android:layout_alignParentStart="true"      android:choiceMode="singleChoice"          android:layout_below="@+id/view2">    </ListView>  <android.support.design.widget.FloatingActionButton  android:id="@+id/fabupload"  android:layout_width="wrap_content"  android:layout_height="fill_parent"      android:layout_marginBottom="40dp"      android:layout_marginRight="40dp"  android:layout_gravity="bottom|end"  android:src="@android:drawable/stat_sys_upload_done"      android:layout_alignParentBottom="true"      android:layout_alignParentRight="true"      android:layout_alignParentEnd="true"      android:onClick="registerDoneClick" />    </RelativeLayout>    

No comments:

Post a Comment