0
Everybody, good afternoon, everybody!
I am developing an app for study purposes. I am a beginner in mobile programming.
My app has an interface similar to the Netflix interface where I’m trying to put Seekbar so that it tells the beginning of the episode of a series and the end.
<SeekBar
android:id="@+id/seekBarDuracao"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toStartOf="@+id/txtFinal"
app:layout_constraintStart_toEndOf="@+id/txtInicio"
app:layout_constraintTop_toBottomOf="@+id/imgDarkJonas" />
Ex: The more you advance the Seekbar, it changes the Textview according to the minutes, but I’m not sure how to do it. If anyone can help me.
public class MainActivity extends AppCompatActivity {
private TextView txtInicio;
private TextView txtFinal;
private SeekBar seekBarDuracao;
private float duracaoEp = 0000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtInicio = findViewById(R.id.txtInicio);
txtFinal = findViewById(R.id.txtFinal);
seekBarDuracao = findViewById(R.id.seekBarDuracao);
//Adicionar listener Seekbar
seekBarDuracao.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
duracaoEp = progress;
txtInicio.setText( Math.round( duracaoEp ) + "");
txtFinal.setText( Math.round( duracaoEp ) + "");
duracao();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void duracao (){ }
Thanks