My findViewById is not working. it does not link...
////my fragment.contacts.xml
*<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="@ id/txtShowOnMap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:contentDescription="@string/locationonmap"
android:importantForAutofill="no"
android:inputType="text"
android:labelFor="@id/btnShowOnMap"
android:minHeight="48dp"
android:text="@string/store_location" />
<Button
android:id="@ id/btnShowOnMap"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/map" />
</LinearLayout>*
////end of fragmentcontacts.xml
my contactsfragment.kt
CodePudding user response:
Please Make it view.findViewById For fragment you need to add rootview.