results store in arraylist how can retrieve that arraylist added results in android
I am implementing synronous class in back ground process I am getting some results. These results are stored in array list in post execute method. How can I retrieve these results?
Code file
public class DownLoanPhoto extends AsyncTask
{
protected void onPreExecute()
{
super.onPreExecute();
}
protected Object doInBackground(Object... params)
{
ArrayList hhh=new ArrayList();
hhh.add(PersonImage);
hhh.add(layoutmsg);
hhh.add(personName);
hhh.add(msgImage);
hhh.add(layoutPersonImage);
Bundle bbb=new Bundle();
bbb.putStringArrayList("val", hhh);
o开发者_StackOverflow中文版nPostExecute(bbb);
}
return params;
}
@Override
protected void onPostExecute(Object result)
{
//How to retrieve that array list results?
layoutPersonImage.addView(msgImage);
layoutPersonImage.addView(PersonImage);
layoutPersonImage.addView(personName);
ll1.setBackgroundResource(R.drawable.tabmessage);
ll1.setGravity(Gravity.CENTER);
ll1.addView(layoutPersonImage);
((LinearLayout)findViewById(R.id.LinearlayoutMessage)).addView(ll1);
}
}
Please forward some solution.
There is no need of calling onPostExecute
in doInBackground
it will be automatically called.
@Override
protected ArrayList<String> doInBackground(Void... url) {
ArrayList<String> list=null;
//Now manipulate your code get the right list
return list;
}
// -- called as soon as doInBackground method completes
@Override
protected void onPostExecute(ArrayList<String> list) {
//Your ui code.
}
精彩评论