Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy DialogFragments renders forceclose in Android 2.3.3?
    primarykey
    data
    text
    <p>As I came to know through <a href="http://developer.android.com/guide/topics/ui/controls/pickers.html" rel="nofollow">this</a> that I need to extend `FragmentActivity rather Activity if <strong>datepicker</strong> is used in older version to android 3.0. If I run this app it force closes. </p> <p>In the site it is mentioned that we need to use <code>getSupportFragmentManager()</code> rather <code>getFragmentManager()</code>. If <code>getFragmentManager()</code> is used my app crashes and shows error if I use <code>getSupportFragmentManager()</code>. Any help would be appreciated. Thanks in Advance here my code.</p> <pre><code>public class MainActivity extends FragmentActivity { static EditText edit = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); edit = (EditText)findViewById(R.id.editText1); edit.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onClick(View arg0) { // TODO Auto-generated method stub DialogFragment newFragment = new DatePickerFragment(); newFragment.show(getFragmentManager(), "datePicker"); } }); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); } public void onDateSet(DatePicker view, int year, int month, int day) { // Do something with the date chosen by the user StringBuffer sb = new StringBuffer(); sb.append(year).append("/").append(month).append("/").append(day); edit.setText(sb); } } } </code></pre> <p><strong>the log file</strong> edited ...</p> <pre><code>12-25 14:23:26.575: E/AndroidRuntime(443): FATAL EXCEPTION: main 12-25 14:23:26.575: E/AndroidRuntime(443): java.lang.NoClassDefFoundError: com.example.datetestapp.MainActivity$DatePickerFragment 12-25 14:23:26.575: E/AndroidRuntime(443): at com.example.datetestapp.MainActivity$1.onClick(MainActivity.java:33) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.view.View.performClick(View.java:2485) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.view.View$PerformClick.run(View.java:9080) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.os.Handler.handleCallback(Handler.java:587) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.os.Handler.dispatchMessage(Handler.java:92) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.os.Looper.loop(Looper.java:123) 12-25 14:23:26.575: E/AndroidRuntime(443): at android.app.ActivityThread.main(ActivityThread.java:3683) 12-25 14:23:26.575: E/AndroidRuntime(443): at java.lang.reflect.Method.invokeNative(Native Method) 12-25 14:23:26.575: E/AndroidRuntime(443): at java.lang.reflect.Method.invoke(Method.java:507) 12-25 14:23:26.575: E/AndroidRuntime(443): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 12-25 14:23:26.575: E/AndroidRuntime(443): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 12-25 14:23:26.575: E/AndroidRuntime(443): at dalvik.system.NativeStart.main(Native Method) 12-25 14:23:28.654: I/Process(443): Sending signal. PID: 443 SIG: 9 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload