(How to call custom list view adapter from fragment)
Any way to call a custom list view adapter and show the list.
I have "Home.axml" and Home.cs(List fragment)
I need to call one custom list view adapter from the Home.cs(List fragment) and display it in Home.axml
below is my code.
Fragment
namespace AndroidApp2.Fragments
{
public class Home : ListFragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, allheading);
ListAdapter = adapter;
return base.OnCreateView(inflater, container, savedInstanceState);
}
}
}
The above code is what am using, it is working fine for me. But how to create a costume list view adapter which is able to call from fragment?
Home.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px">
<fragment
android:id="@+id/heading_fragment"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/details"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
</LinearLayout>