views:

17

answers:

0

My XML structure has a view flipper in linear layout which is again in Frame layout. I am not able to flip my layout and see next child. I want to apply it on OnTouch() of layout

@Override
  public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        Log.i("onTouch", "INDSIDE ONTOUCH OF FLIPPER");
        // TODO Auto-generated method stub
        // Get the action that was done on this touch event
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
              // store the X value when the user's finger was pressed down
        downXValue = event.getX();
        Log.i("DOWN X VALUE", "" + downXValue);
              break;

        case MotionEvent.ACTION_UP:
              Log.i("ACTION_UP", "INDSIDE ONTOUCH ACTION_UP");
               // Get the X value when the user released his/her finger
        float currentX = event.getX();            

        // going backwards: pushing stuff to the right
        if (downXValue < currentX)
        {
              //custBaseAdapter = new CustomBaseAdapterForList(getApplicationContext(), itemsName_Day1, itemsTime_Day1);
              custBaseAdapter.setListItems(itemsName_Day1, itemsTime_Day1);
              listView = (ListView) findViewById(R.id.itineraryListView_Day2);
              listView.setAdapter(custBaseAdapter);

            // Get a reference to the ViewFlipper
             ViewFlipper vf = (ViewFlipper) findViewById(R.id.ItinerayDayFlipper);
             // Set the animation
              vf.setAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_out));
             //vf.setAnimation(animate);
              // Flip!
              vf.showPrevious();
              //vf.startAnimation(animate);
        }

        // going forwards: pushing stuff to the left
        if (downXValue > currentX)
        {
              //custBaseAdapter = new CustomBaseAdapterForList(getApplicationContext(), itemsName_Day2, itemsTime_Day2);
              custBaseAdapter.setListItems(itemsName_Day3, itemsTime_Day3);
              listView = (ListView) findViewById(R.id.itineraryListView_Day3);
              listView.setAdapter(custBaseAdapter);

            // Get a reference to the ViewFlipper
            ViewFlipper vf = (ViewFlipper) findViewById(R.id.ItinerayDayFlipper);
             // Set the animation
            vf.setAnimation(AnimationUtils.loadAnimation(this, R.anim.push_left_in));
             //vf.setInAnimation(animate);
              // Flip!
             vf.showNext();
             //vf.startAnimation(animate);
        }

              break;
        }
        return true;
  }

Can someone suggest something?