title: How can call a method in onCreateView Android
body: <p>How can I call a  method in onCreateView in android <code>Fragment</code>?</p>
  
  <p>onCreateView code: </p>
  
  <pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           final Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View rootView = inflater.inflate(R.layout.fragment_user_list, container, false);
      btnBusquedaUserList = (Button) rootView.findViewById(R.id.btnBuscarUserList);
      rvUserList = (RecyclerView) rootView.findViewById(R.id.rvUserList);
      rvUserList.setLayoutManager(new LinearLayoutManager(getContext()));
      txtCIbusqueda = (TextInputEditText) rootView.findViewById(R.id.txtCIUserList);
  
      getActivity().setTitle("Lista Usuarios Check In");
      Bundle args = getArguments();
      idUsuario = args.getString("idLogueado");
  
      GetClient();
  
      btnBusquedaUserList.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              ciUser = txtCIbusqueda.getText().toString();
              Object lista[] = new Object[2];
              lista[0] = ciUser;
              lista[1] = idUsuario;
              parametroApi.setDatoG(lista);
              GetClient();
  
          }
      });
  
      return rootView;
  
  
  };
  </code></pre>
  
  <p>My method <code>GetClient()</code></p>
  
  <pre><code>public void GetClient() {
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl("http://80.241.210.8:8080/Exma/Service/api/")
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      ExmaApi service = retrofit.create(ExmaApi.class);
      Call&lt;Respuesta&lt;List&lt;DataList&gt;&gt;&gt;call=service.putClientList(parametroApi);
  
         call.enqueue(new Callback&lt;Respuesta&lt;List&lt;DataList&gt;&gt;&gt;() {
          @Override
          public void onResponse(Call&lt;Respuesta&lt;List&lt;DataList&gt;&gt;&gt; call, 
           Response&lt;Respuesta&lt;List&lt;DataList&gt;&gt;&gt; response) {
              if (response.isSuccessful()) {
                  Respuesta&lt;List&lt;DataList&gt;&gt; respuesta = response.body();
                  try {
                      if (respuesta.respuestaExitosa() == true) {
                          Log.d(TAG, "TodoBien: " + respuesta.toString());
                          rvAdapter = new MyRecyclerViewAdapter(getActivity().getApplicationContext(), respuesta);
                          rvUserList.setAdapter(rvAdapter);
  
                      }
  
                  } catch (Exception e) {
                      Log.d(TAG, "onResponse" + "Ocurrio un Error");
                      e.printStackTrace();
  
                  }
              }
          }
  
          @Override
          public void onFailure(Call&lt;Respuesta&lt;List&lt;DataList&gt;&gt;&gt; call, Throwable t) {
              Log.d(TAG, "TodoMal: " + t.getMessage().toString());
  
          }
      });
  
  
  }
  </code></pre>
  
  <p>I have trouble when I want to call a method <code>GetClient()</code> in <code>onCreateView</code>, the method does not start, but in onClickListener from the button, the method start without problems, any way to call the method? in <code>onCreateView</code> from <code>Fragments</code>, I want to execute the method at the time that fragment start</p>