I have a fragment that has a button. After clicking the button, the following code is executed:
@Override public void onClick(View clickedView) { switch(clickedView.getId()) { case R.id.btnTest: FragmentManager fm = getSherlockActivity().getSupportFragmentManager(); MyDialog dialog = new MyDialog(); dialog.show(fm, "TaskDeadlineDialog"); break; } }
My piece of dialogue looks like this:
public class MyDialog extends DialogFragment { public MyDialog() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedBundleInstance) { View currentView = inflater.inflate(R.layout.my_dialog_layout, parent); System.out.println("Inflated!"); return currentView; } }
What happens, the dialog is not displayed, and the application stops responding. I am testing this on a Samsung SII with CMS ICS.
Edit: Logcat shows nothing.
12-21 16:05:16.970: I/System.out(15753): debugger has settled (1304) 12-21 16:05:18.250: D/dalvikvm(15753): VFY: replacing opcode 0x6f at 0x0006 12-21 16:05:18.445: I/System.out(15753): Got ID: 1 12-21 16:05:20.430: I/System.out(15753): List position: 0 12-21 16:05:23.225: I/System.out(15753): Inflated! 12-21 16:05:38.510: D/dalvikvm(15753): GC_CONCURRENT freed 2265K, 41% free 4867K/8131K, paused 3ms+6ms 12-21 16:05:51.895: D/dalvikvm(15753): GC_CONCURRENT freed 1797K, 42% free 4787K/8131K, paused 2ms+2ms ..etc
What am I doing wrong?
source share