I have two layouts and my UI will look Menu Bar
-----------------------------------------------------
| |
| Button 1 |
-----------------------------------------------------
| | |
| S1 | S2 |
-------------------------------------------------------
| |
| EditText |
--------------------------------------------------------
The XML For my upper part
-----------------------------------------------------
| |
| Button 1 |
-----------------------------------------------------
| | |
| S1 | S2 |
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="ag.ap.tagassigner.TagAssignmentHolder">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
The Text field is in an fragment and it is in another layout
-------------------------------------------------------
| |
| EditText |
--------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="ag.ap.tagassigner.TagAssignment">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/serialNoField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="35dp"
android:hint= "@string/serialno_plh"
/>
I am having the button in the menu bar
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto/android">
<!-- Refresh -->
<item android:id="@+id/action_refresh"
android:icon="@drawable/ic_menu_camera"
android:title="@string/action_barcode"
app:showAsAction="ifRoom"
android:onClick="scanBarcode"
/>
<!-- Help -->
<item android:id="@+id/action_help"
android:icon="@drawable/ic_menu_camera"
android:title="@string/action_camera"
app:showAsAction="ifRoom"
/>
</menu>
I want fill the value of editText if click on Button 1 . How do i acheive it ?