Posts

Showing posts from April, 2015

A Material styled AlertDialog

Image
Are you looking for a Material styled AlertDialog?

Here a short gist to migrate the "old" AlertDialog AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Dialog"); builder.setMessage("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo,"); builder.setPositiveButton("OK", null); builder.setNegativeButton("Cancel", null); builder.show(); Now you can use the new android.support.v7.app.AlertDialog and the the code becomes: import android.support.v7.app.AlertDialog; AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle); builder.setTitle("Dialog"); …