Java Code Examples for android.widget.RatingBar.setOnRatingBarChangeListener()

The following are Jave code examples for showing how to use setOnRatingBarChangeListener() of the android.widget.RatingBar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: 2017.1-Trezentos   File: EvaluationViewHolder.java   View Source Code Vote up 5 votes
public EvaluationViewHolder(View view) {
    super(view);
    className = (TextView) view.findViewById(R.id.student_class);
    examName = (TextView) view.findViewById(R.id.student_exam);
    userAccountName = (TextView) view.findViewById(R.id.student_name);
    ratingBar = (RatingBar) view.findViewById(R.id.ratingBar);
    ratingBar.setOnRatingBarChangeListener(this);
}
 
Example 2
Project: iosched-reader   File: SessionFeedbackFragment.java   View Source Code Vote up 4 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.session_feedback_frag, container, false);

    mTitle = (TextView) rootView.findViewById(R.id.feedback_header_session_title);
    mSpeakers = (TextView) rootView.findViewById(R.id.feedback_header_session_speakers);
    mOverallFeedbackBar = (RatingBar) rootView.findViewById(R.id.rating_bar_0);
    mSessionRelevantFeedbackBar = (NumberRatingBar) rootView.findViewById(
            R.id.session_relevant_feedback_bar);
    mContentFeedbackBar = (NumberRatingBar) rootView.findViewById(R.id.content_feedback_bar);
    mSpeakerFeedbackBar = (NumberRatingBar) rootView.findViewById(R.id.speaker_feedback_bar);

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // Helps accessibility services determine the importance of this view.
        mOverallFeedbackBar.setImportantForAccessibility(RatingBar.IMPORTANT_FOR_ACCESSIBILITY_YES);

        // Automatically notifies the user about changes to the view's content description.
        mOverallFeedbackBar.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_ASSERTIVE);
    }

    // When the rating changes, update the content description. In TalkBack mode, this
    // informs the user about the selected rating.
    mOverallFeedbackBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
        @Override
        public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            ratingBar.setContentDescription(
                    getString(R.string.updated_session_feedback_rating_bar_content_description, (int) rating));
        }
    });

    rootView.findViewById(R.id.submit_feedback_button).setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    submitFeedback();
                }
            }
    );
    return rootView;
}