title: How to stop fetching data from json after sending a new request android retrofit?
body: <p>In my app I use <code>Retrofit</code> and I have such situation:my app contains bottomNavigationView with 5 items which are assigned to a certain fragment, each fragment at <code>onCreateView()</code> method has method call at which we send request to API. I can create a situation when I can send several requests when I tap on different items for replacing current fragment. I would like to prevent sending several requests if it's possible. I have some thoughts about it:</p>
  
  <ol>
  <li>Use dispatcher at retrofit client with max requests - <code>setMaxRequests(1)</code></li>
  <li>Make retrofit client to clear all request - <code>client.dispatcher().cancelAll()</code></li>
  <li>Check when current fragment is visible to user and make request - <code>userVisibleHint</code></li>
  </ol>
  
  <p>Or someone had similar problem and knows how to solve it. What I see at logs  after tapping several times for example on one item of bottomNavigationView - several requests and several responses. Hope you will help me :)</p>