Android Open Source - RateMyApp Number Of Stars Dialog Listener

From Project

Back to project page RateMyApp.


The source code is released under:

MIT License

If you think the Android project RateMyApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mariosangiorgio.ratemyapp.listeners;
//from   ww w  .j a v  a2 s  .  c  o m
import android.content.Context;
import android.content.DialogInterface;

import com.mariosangiorgio.ratemyapp.actions.Action;

public class NumberOfStarsDialogListener implements DialogClickListener{
    private final Action positiveAction;
    private final Action negativeAction;

    public NumberOfStarsDialogListener(Action positiveAction, Action negativeAction) {
        if (positiveAction == null) {
            throw new IllegalArgumentException("positiveAction should not be null");
        this.positiveAction = positiveAction;

        if (negativeAction == null) {
            throw new IllegalArgumentException("negativeAction should not be null");
        this.negativeAction = negativeAction;

    public void onClick(DialogInterface dialogInterface, int buttonPressed, Context context, FragmentManager fragmentManager) {
        switch (buttonPressed) {
            case DialogInterface.BUTTON_POSITIVE:
                positiveAction.execute(context, fragmentManager);
            case DialogInterface.BUTTON_NEGATIVE:
                negativeAction.execute(context, fragmentManager);

Java Source Code List