Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed access to views on the OnSeekBarChangeListener (which is in an own class)
    primarykey
    data
    text
    <p>First of all, I hope you understand my English, because I'am not a native speaker. </p> <p>Okay, I am new to Android development and I'm trying following for in app: I need a <code>SeekBar</code>, so I created a <code>Seekbar</code> via XML and implemented an <code>OnSeekBarChangeListener</code>. </p> <p>In the company I work for, it's forbidden (because of the <code>styleguid</code>) to create something like this:</p> <pre><code>seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) { /// Do something } ... }); </code></pre> <p>So I need to create my own class for the <code>OnSeekBarChangeListener</code>. So far no problem.</p> <pre><code>public class SeekBarChangeListener extends OnSeekBarChangeListener { public SeekBarChangeListener(Context context) { super(context); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { /// Do something. Following Code wont work CheckBox RemeberUsername = (CheckBox)findViewById(R.id.RemeberUsername); /// Always gets NULL } } </code></pre> <p>I need a way to get access to some controls. Normally, the <code>findViewById</code> works fine, but not in this case: something that I can totally understand, because how should the listener know about the views?</p> <p>Do you have good hints? </p> <p>Or is there no other way like the first code snippet to get the controls? </p> <p>Hope someone can help me out.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload