You can save it where you want, you could save it after you get it or in onPause
(which is called when your activity is paused)
Save it in onPause
if the user is going to modify it and you need to save it.
Or, if you just need it and you will not change it anymore save it in onPostExecute
, or everytime you change it.
SharedPreference
don't have a "lifetime" it will exists until the application is in the device, or until the user don't clear data app.
For your doBackground
you could add a timeout to your request.
Change your code block:
HttpClient httpclient = new DefaultHttpClient();
to
BasicHttpParams params = new BasicHttpParams();
ConnManagerParams.setTimeout(params, TIMEOUT_IN_MILLISECONDS); // example: 2000 for 2 seconds
HttpClient httpClient = new DefaultHttpClient(params);