When watching my app through the Device Manager I came across behaviour with the inflater that I was hoping someone in the stack overflow community could help me understand. I have a fragment that when It uses the layout inflater to inflate an EditText it spawns two Async Tasks. Why are these getting spawned and what can I do to prevent this or close them afterwards?
When I comment out the EditText, right after the fragment loads I see this:
My fragment looks like:
public class SearchFragment implements View.OnClickListener{
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String TAG = "HistorySearchFragment";
private static final String ARG_SECTION_NUMBER = "sectionNumber";
public static SearchFragment newInstance(int sectionNumber) {
SearchFragment fragment = new SearchFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_search, container, false)
return view;
}
}
fragment_search.xml looks like
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
tools:context="com.main.SearchFragment"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/search_button_bw"
android:layout_below="@+id/space"
android:isScrollContainer="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
/*************************************************
THIS TEXT BOX HERE
/************************************************/
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
/*************************************************
To here
/************************************************/
</RelativeLayout>
</ScrollView >
<Button
android:id="@+id/search_button_bw"
android:layout_width="match_parent"
android:layout_height="70dp"
android:text="Search"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
I have verified that this only happens when this fragment loads and the Tasks get spawned every time without fail. Does anyone have any idea why this is happening and how I can prevent it?