android - One fragment with two types of display -


i need fragment shows in container , shows dialog.

this sample code maybe help

myfragment frag=new myfragment();  //sometimes    fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); fragmenttransaction.add(r.id.container, frag, tag);  //sometimes  frag.show(getfragmentmanager(), null); 

you can use fragment extends dialogfragment either embedded view or dialog. please refer part of guide in documentation detailed explanation. have used approach , works perfectly. http://developer.android.com/reference/android/app/dialogfragment.html#dialogorembed


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -