LyingInAHammock 0 Newbie Poster

Basically I've created an app drawer and placed a seekbar within it. This app drawer is made up from app_drawer.xml whilst my fragment below is made up from main_activity.xml.

The issue I'm having is, although the seekbar shows up perfectly and the app drawer pulls in and out as it should, when I drag it nothing happens (By which I mean the textview is NOT updated)

Even though it should

Before anyone suggests it is that the seekbar is the problem, it is part of a listener event which means it is called every-time progress changes. So it won't be destroyed when oncreate finishes.

  • I have attempted to run seekbar normally on the same xml as
    everything else and it works fine.

The problem is to do with the fact I'm attempting to utilise 2 xml files in the below fashion.

I was thinking it may have something to do with the parameter ''container''. I also considered it may have something to do with the fact I'm only returning rootView not rootView and rootView2.

How do I get this to work correctly?

My fragment code is below:

            public class MainActivity extends Fragment {

                @Override
                public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {

                    View rootView = inflater.inflate(R.layout.main_activity, container, false);
                    View rootView2 = inflater.inflate(R.layout.app_drawer, container, false);



             final SeekBar sk=(SeekBar) rootView2.findViewById(R.id.seekBar1);  
             TextView textProgress = (TextView)rootView.findViewById(R.id.TextView01);

                  sk.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {   

                  public void onProgressChanged(SeekBar bar, int progress,
                        boolean fromUser) {

     textProgress.setText("Progress: "+ String.valueOf(progress));
        }
                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                    // TODO Auto-generated method stub

                }
                  });

                    return rootView;
                }
            }