title: Set OnTouchListener for Fragment
body: <p>I have an application that have multiple fragments </p>
  
  <p>For each fragment I want to perform some operation when touching that fragment</p>
  
  <p>I have a fragment that draws a bitmap for me and I want this fragment to be full screen when touching
  The fragment has an image view that sets it to the bitmap 
  I tried setting OnTouchListener inside the fragment for the view but I do not want that because each time the user press on the screen it will Start the activity even if it is already on full screen
  How can I add the OnTouchListener  in my main activity for the fragment </p>
  
  <p>Here is my code</p>
  
  <p>in <strong>Main Activity</strong> I'm doing this </p>
  
  <pre><code> public class MainActivity extends Activity  {
                       DrawBitmap drawView;           
                       drawView = (DrawBitmap ) getFragmentManager().findFragmentById(R.id.drawid);
  
                      }
  </code></pre>
  
  <p>in <strong>DrawBitmap</strong> class which is my <strong>fragment</strong> </p>
  
  <pre><code>   public class DrawBitmap extends Fragment  {
  
      @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      View v = inflater.inflate(R.layout.imgid, container, true);
  
      v.setOnTouchListener(new View.OnTouchListener() {
  
          @Override
            public boolean onTouch(View v, MotionEvent event) {
              int action = event.getAction();
                switch(action){
                    case MotionEvent.ACTION_DOWN:
  
                        Intent intent = new Intent(getActivity(), SecondActivity.class);
                        startActivity(intent);
                                break;
  
                }
  
                return false;
            }
  
      });
      return v;
  
  
  }
  
    }
  </code></pre>
  
  <p>in <strong>SecondActivity</strong></p>
  
  <pre><code>                public class SecondActivity extends Activity  {
                       DrawBitmap drawView;           
                       drawView = (DrawBitmap ) getFragmentManager().findFragmentById(R.id.drawid_full);
  
                      }
  </code></pre>
  
  <p>I want to be able to add <code>OnTouchListener</code> for <code>drawView</code> in <strong>Main Activity</strong> </p>