I want to create an android app which has a seekbar that sets the distance range from the user's location kinda like Tinder does. How do I do this?
Here's what I tried so far, but I have no idea where to go from here. It's probably completely wrong tho.
Thanks for any help
public class MainActivity extends AppCompatActivity {
public static SeekBar seek_bar;
public static TextView text_view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seek_bar();
}
public void seek_bar( ) {
seek_bar = (SeekBar) findViewById(R.id.DistanceSeekBar);
text_view = (TextView) findViewById(R.id.DistanceTextView);
text_view.setText(seek_bar.getProgress() + " / " + seek_bar.getMax());
seek_bar.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int progress_value;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress_value = progress;
text_view.setText(progress + " / " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in progress", Toast.LENGTH_LONG).show();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast.LENGTH_LONG).show();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
text_view.setText("Covered : " + progress_value + " / " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast.LENGTH_LONG).show();
}
}
);
}