Rating Bar in Android.
rates = (EditText) findViewById(R.id.rates);
rates.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(rates.getText().length()>0)
{
ratingBar.setRating(Float.parseFloat(rates.getText().toString()));
rating_val.setText(String.valueOf(rates.getText().toString()));
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
}
});
rates.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(rates.getText().length()>0)
{
ratingBar.setRating(Float.parseFloat(rates.getText().toString()));
rating_val.setText(String.valueOf(rates.getText().toString()));
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
}
});