android - Remove a fragment with linearlayout -


i have linear layout this:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"      android:layout_width="match_parent"     android:layout_height="match_parent"      android:orientation="vertical" >  <textview     android:id="@+id/detailstext"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_gravity="center_horizontal|center_vertical"     android:layout_margintop="20dip"     android:text="default text"     android:textappearance="?android:attr/textappearancelarge"     android:textsize="30dip" /> 

and in activity (container of 2 fragments), call:

            getfragmentmanager().begintransaction().remove(getfragmentmanager().findfragmentbyid(r.id.fragmentcontainer)).commit(); 

where fragmentconteiner id used framelayout (insted linearlayout) got nullpointerexeption

which correct id?

you can remove fragments using fragment manager using tags assigned fragments. code be:

getfragmentmanager().begintransaction().remove(getfragmentmanager().findfragmentbytag(frag_tag).commit(); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -