Как с помощью AnsysTask этот процесс выполнить перед onCreate() и передать полученные ему полученные данные!
try
{
InputStream is = getResources().openRawResource(R.raw.jsontwitter);
byte [] buffer = new byte[is.available()];
while (is.read(buffer) != -1);
String jsontext = new String(buffer);
final JSONArray entries = new JSONArray(jsontext);
JSONObject post;
try {
post = entries.getJSONObject(0);
detoks_p = Double.parseDouble(post.getString("price"));
detoks_k = post.getString("good_code");
detoks_op = post.getString("description");
post = entries.getJSONObject(1);
antioks_p = Double.parseDouble(post.getString("price"));
antioks_k = post.getString("good_code");
post = entries.getJSONObject(2);
paks_p = Double.parseDouble(post.getString("price"));
paks_k = post.getString("good_code");
post = entries.getJSONObject(3);
nutrimaks_p = Double.parseDouble(post.getString("price"));
nutrimaks_k = post.getString("good_code");
post = entries.getJSONObject(4);
sveltform_k = post.getString("good_code");
sveltform_p = Double.parseDouble(post.getString("price"));
post = entries.getJSONObject(5);
chromvital_p = Double.parseDouble(post.getString("price"));
chromvital_k = post.getString("good_code");
post = entries.getJSONObject(6);
seiftusi_p = Double.parseDouble(post.getString("price"));
seiftusi_k = post.getString("good_code");
post = entries.getJSONObject(7);
senior_p = Double.parseDouble(post.getString("price"));
senior_k = post.getString("good_code");
post = entries.getJSONObject(8);
lsbalans_p = Double.parseDouble(post.getString("price"));
lsbalans_k = post.getString("good_code");
post = entries.getJSONObject(11);
senior_ledi_p = Double.parseDouble(post.getString("price"));
senior_k = post.getString("good_code");
post = entries.getJSONObject(16);
endjoyNT_p = Double.parseDouble(post.getString("price"));
endjoyNT_k = post.getString("good_code");
post = entries.getJSONObject(17);
osteosanum_p = Double.parseDouble(post.getString("price"));
osteosanum_k = post.getString("good_code");
post = entries.getJSONObject(19);
direset_p = Double.parseDouble(post.getString("price"));
direset_k = post.getString("good_code");
post = entries.getJSONObject(21);
vineks_p = Double.parseDouble(post.getString("price"));
vineks_k = post.getString("good_code");
post = entries.getJSONObject(22);
breinofleks_p = Double.parseDouble(post.getString("price"));
breinofleks_k = post.getString("good_code");
post = entries.getJSONObject(23);
sheviton_p = Double.parseDouble(post.getString("price"));
sheviton_k = post.getString("good_code");
post = entries.getJSONObject(24);
neichetan_p = Double.parseDouble(post.getString("price"));
neichetan_k = post.getString("good_code");
post = entries.getJSONObject(26);
mega_p = Double.parseDouble(post.getString("price"));
mega_k = post.getString("good_code");
post = entries.getJSONObject(27);
bisk_p = Double.parseDouble(post.getString("price"));
bisk_k = post.getString("good_code");
post = entries.getJSONObject(28);
revien_p = Double.parseDouble(post.getString("price"));
revien_k = post.getString("good_code");
post = entries.getJSONObject(29);
giper_p = Double.parseDouble(post.getString("price"));
giper_k = post.getString("good_code");
post = entries.getJSONObject(30);
mistik_p = Double.parseDouble(post.getString("price"));
mistik_k = post.getString("good_code");
post = entries.getJSONObject(31);
passilat_p = Double.parseDouble(post.getString("price"));
passilat_k = post.getString("good_code");
post = entries.getJSONObject(32);
ursul_p = Double.parseDouble(post.getString("price"));
ursul_k = post.getString("good_code");
post = entries.getJSONObject(33);
lamin_p = Double.parseDouble(post.getString("price"));
lamin_k = post.getString("good_code");
post = entries.getJSONObject(34);
artum_p = Double.parseDouble(post.getString("price"));
artum_k = post.getString("good_code");
post = entries.getJSONObject(35);
biuty_p = Double.parseDouble(post.getString("price"));
biuty_k = post.getString("good_code");
post = entries.getJSONObject(36);
nortia_p = Double.parseDouble(post.getString("price"));
nortia_k = post.getString("good_code");
post = entries.getJSONObject(37);
granatin_p = Double.parseDouble(post.getString("price"));
granatin_k = post.getString("good_code");
post = entries.getJSONObject(38);
stalon_p = Double.parseDouble(post.getString("price"));
stalon_k = post.getString("good_code");
post = entries.getJSONObject(39);
mediossoia_k = post.getString("good_code");
mediossoia_p = Double.parseDouble(post.getString("price"));
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (Exception je)
{
}