I am trying to embed a Fragment in either a Dialog or DialogFragment
public class addAccountDialog extends DialogFragment
{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
View view = inflater.inflate(R.layout.add_account_dialog, container);
accountType.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id)
{
passwordFragment newFragment = new passwordFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_base, newFragment);
transaction.commit();
}
}
}
}
<LinearLayout
android:id="@+id/fragment_base"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="3" >
</LinearLayout>
I have tried this using with both a Dialog and DialogFragmentto no avail. Has anyone been able to implement a fragment inside a dialog.
thank you in advance.
Roger