Skip to content

Instantly share code, notes, and snippets.

@prasad091
Last active January 3, 2017 06:49
Show Gist options
  • Save prasad091/5ce09300f253583328e235c7d7fb4b66 to your computer and use it in GitHub Desktop.
Save prasad091/5ce09300f253583328e235c7d7fb4b66 to your computer and use it in GitHub Desktop.
Alert Dialog
package com.kgislias.messenger;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
/**
* Created by admin on 03-01-2017.
*/
public class AlertBuild extends AppCompatActivity{
public void onErrorDialog(String title,String message){
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.MyAlertDialogStyle);
builder.setTitle(title);
builder.setMessage(message);
builder.setPositiveButton("OK", null);
builder.setNegativeButton("Cancel", null);
builder.show();
}
}
<style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- Used for the buttons -->
<item name="colorAccent">@color/white</item>
<!-- Used for the title and text -->
<item name="android:textColorPrimary">#FFFFFF</item>
<!-- Used for the background -->
<item name="android:background">#4CAF50</item>
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment