android - Hide Snackbar automatically when Internet Connection available -


i've added snackbar when there no internet connection available.but want hide snackbar when connection becomes available.snackbar should automatically show , hide whenever connection lost. consideration.

here code

if(mobile == networkinfo.state.connected || mobile == networkinfo.state.connecting){      }else if(wifi == networkinfo.state.connected || wifi == networkinfo.state.connecting){      }else{         snackbar snackbar = snackbar.make(view, "can't connect! check whether you're online or not", snackbar.length_indefinite);         snackbar.show();     } 

thanks in advance!!


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -