Skip to content Skip to sidebar Skip to footer

Android - How To Declare A Widget From Another Layout?

I have a fragment layout that contains a class, but it needs to edit an imageview that is in another layout fragment. Example: public class LayoutFragment extends Fragment { privat

Solution 1:

The issue may be because you are paying null as a parent in inflater.

So instead of passing null in parent of

LinearLayout relativeLayout = (LinearLayout) inflates.inflate(id, null, false);

try passing a view in that like

LinearLayout relativeLayout = (LinearLayout) inflates.inflate(id, layout, false);

But from your code I'm not sure that what's the value of layout variable inside add method.

Post a Comment for "Android - How To Declare A Widget From Another Layout?"