0

次のように、フロートを渡そうとするダイアログがあります。

public void rateDialog(View v){
        // custom dialog

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
// Add the buttons
        builder.setPositiveButton("save", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // User clicked OK button
            }
        });
        builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // User cancelled the dialog
            }
        });
    // Set other dialog properties

        // Create the AlertDialog
        builder.setTitle("Rate this Beer");
        builder.setView(getLayoutInflater().inflate(R.layout.rate_stars, null));
        AlertDialog dialog = builder.create();

        RatingBar ratingBar = (RatingBar) this.findViewById(R.id.beerRatingBar);
        float stars = ratingBar.getRating();


        dialog.show(stars);

    // Create the AlertDialog



    }

これは実際に可能ですか?

4

2 に答える 2

0

最終として宣言できます:

public void rateDialog(View v){
    // custom dialog

   final Float value = 1;

}

ダイアログで使用します。

于 2013-09-27T02:09:35.960 に答える