Reputation: 111
In DatagramSocket reference (link to reference page), it is shown that
public void connect (SocketAddress peer)
function throws SocketException
if an error occurs but in fact it may throw NetworkOnMainThreadException
when the function runs on UI thread in Honeycomb or higher.
So my question is why NetworkOnMainThreadException
is not written under Throws title and only SocketException
is written?
Upvotes: 0
Views: 133
Reputation: 1006759
Because SocketException
is a checked exception, and NetworkOnMainThreadException
is an unchecked exception.
Upvotes: 3