I want to connect two separate seekbar with two text views. This "text
views" should show the value of the associated seekbar.
How must i do this in the MainActivity
Thank you very much.
PS: My solution: but it doesnt work correct:
import android.app.Activity;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;
public class MainActivity extends Activity
implements SeekBar.OnSeekBarChangeListener
//der Listener scheint folgende Methoden zu erwarten:
onProgressChanged, onStartTrackingTouch, onStopTrackingTouch
{
int groesse;
SeekBar greosseSeekBar, gewichtSeekBar, bmiSeekBar;
@Override
public void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.main);
greosseSeekBar = (SeekBar)findViewById(R.id.seekBar1);
greosseSeekBar.setOnSeekBarChangeListener(this);
gewichtSeekBar = (SeekBar)findViewById(R.id.seekBar2);
gewichtSeekBar.setOnSeekBarChangeListener(this);
bmiSeekBar = (SeekBar)findViewById(R.id.seekBar3);
bmiSeekBar.setOnSeekBarChangeListener(this); }
public void onProgressChanged(SeekBar greosseSeekBar, int
progress, boolean fromTouch)
{
TextView text =(TextView)findViewById(R.id.editText2);
text.setText(Integer.toString(progress)); }
public void onStartTrackingTouch(SeekBar greosseSeekBar) {
// TODO Auto-generated method stub }
public void onStopTrackingTouch(SeekBar greosseSeekBar) {
// TODO Auto-generated method stub
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en