Search code examples
javaandroidviewpreference

Custom SeekBarPreference setProgress from a different class?


Hello I am wondering how to use the following method findViewById(int id) inside a class that extends Preference that has a method defined called setProgress(int progress) which uses the method findViewById so that way in another class that extends PreferenceActivity I could use the method setProgress(int progress). So since the method findViewById is defined in the class android.view.View how am I suppose to use the method.


Solution

  • You would have to pass either a specific View or an Activity to the function, or if the setProgress function isn't static, store the View or Activity in a variable inside the class somehow.