title: Android - how to get the layout id from a view?
body: <p>Hello fellow developers!</p>
  
  <p>i'll keep this as simple and short as I can,
  I have a fragment, and in my onCreateView I am sometimes giving it different layouts depend on my status.</p>
  
  <p>is there any way of knowing on which layout I am? </p>
  
  <p>code below:</p>
  
  <p>my onCreateView:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      View view;
  
      if (programState) {
          view = inflater.inflate(R.layout.fragment_home_program_on, container, false);
      } else {
          view = inflater.inflate(R.layout.fragment_home, container, false);
      }
  
      findViews(view);
      setupViews();
      return view;
  }
  </code></pre>
  
  <p>basically, my "findViews" method gets that View, and I was wondering if there's a way to know which layout i am on with a switch statement for example or something like that.. like this :</p>
  
  <pre><code>private void findViews(View mainView) {
  
      switch(mainView) {
          case R.layout.fragment_home:
              //do work
              break;
          case R.layout.fragment_home_program_on:
              //do work
              break;
      }
  }
  </code></pre>
  
  <p>I am trying to do something like that with no success.. all i get is errors and such, is there a way to do that?</p>
  
  <p>thanks a lot in advance</p>