ui


  • (Android) Simple confirm dialog

    [java] private void confirmDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder .setMessage("Are you sure?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Yes-code } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog,int id) { dialog.cancel(); } }) .show(); } [/java]

    read more…

  • (Android) Custom view orientation change – restore state.

    Here’s one pretty simple way to get your custom view to restore its current state after an orientation change: You can of course put any values in there, for example if you need to restore fields. (quickly plotted code. Haven’t run it, but it should work) [java] @Override protected Parcelable onSaveInstanceState() { Bundle bundle =…

    read more…

  • (Android) Prevent config change on orientation change

    Add to activity in manifest: [xml]android:configChanges="keyboardHidden|orientation|screenSize"[/xml]

    read more…