Reputation: 1214
I am using Volley Json to connect my android app to web sever. It works fine at normal time. But when there is no connection while connecting the server, it toast "java.net.UnknownHostException: Unable to resolve host "www.example.com":No address associated with hostname". The app does not crush but as it show UnknownHostException error toast, it can probably annoy user. How can I hide that toast or handle that error. Please answer me.
Upvotes: -3
Views: 2467
Reputation: 461
This is happening due to the internet connection error. If the internet connection is not there error listener get activated and it show the toast message. if you don't want that toast message just remove it in error listener.
Upvotes: 1
Reputation: 7104
Just comment out the toast statement inside
@Override
public void onErrorResponse(VolleyError error) {
//Toast.makeToast(this,"toast",Toast.LENGTH_SHORT).show();
}
Upvotes: 3