Hello Pedro,
from my point of view it doesn't make sense to wrap each statement
into a try..catch. In you sample if httpclient.execute() fails, then
I'm not sure that response.getEntity().getContent() makes sense, since
there was no response.
I would rewrite your sample as:
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
response = httpclient.execute(httpPost);
content = response.getEntity().getContent();
} catch(UnsupportedEncodingException e) {
// Some error handling
} catch(ClientProtocolException e) {
// Some error handling
} catch(IOException e) {
// Some error handling
} catch(IllegalStateException e) {
// Some error handling
}
Thus you have a one set of catch blocks per scenario not per
individual step. Using catch(Exception e) is not a good practice,
since you can miss something (usually run-time exception) you should
handle on development stage.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en