Quick Question. I wrote some View Classes and included them in a Fragment via XML.These View Classes are getting inflated.
private void inflateView(Context context){
inflater =(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.layout_motoreffiziens_view, this, true);
}
In the onCreateView of the my fragment I get the View reference by findViewById. To fullfill some task i implemented a listener for my View which I can add with my intern method addListeners(myCustomListener).
My Problem is now that I cant call methods (because its obviously a View and not a ClassReference).
My View Header
public class MotorSelection extends RelativeLayout implements Spinner.OnItemSelectedListener {
private LayoutInflater inflater;
private SpinnerChange spinnerChangeListener = null ;
This View is nested in my Fragment XML :
<com.example.andy.einzelprojekt1.views.MotorSelection
android:id="@+id/view_motor_selection"
android:layout_width="match_parent"
android:layout_height="wrap_content">
So my Question is how I can use my Methods from inflated Views? More specific:
In the onCreate of my Fragment I want to acess this view and add a listener.
Greetings
/e 20.5.16