I have an application with TabHost with few tabs and in each tab I am displaying some web-page getting it from the server using HttpClient. Is it a good practice to open and instantiate a new HttpClient on every tab?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you display a different web page in each tab, I’d go with one HttpClient per tab. But it really depends on what your exact requirement. For example, if you do not wish to update a tab while it is not being shown, you could reuse your HttpClient instance. That would, of course, place the onus of managing the state of the HttpClient between tab switches on you.