java - Updating information like TextViews and Buttons from the main Activity class -
i hope find well. new android , trying follow tutorials on androidhive
on developing android applications. cam across following tutorial on developing drawers. http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/. wondering if have button inside 1 of layout files fragement_home.xml how go updating main activity class.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/txtlabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:textsize="16dp" android:text="home view"/> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/txtlabel" android:src="@drawable/ic_home" android:layout_centerhorizontal="true" android:layout_margintop="10dp"/> <button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="40dip" android:background="@color/btn" android:text="@string/btn" android:textallcaps="false" android:textcolor="@color/white" android:textsize="15dp"/> </relativelayout>
lets want access button btn in fragment_home.xml , want implement listeners on button.
thank you.
you defining object of fragment in main activity .make buton or textview or view public in fragment. can access them in main activity can change view demand
Comments
Post a Comment