1

I have a listview with some items. When clicking an item from this list, I have another activity with a new listview which will show some informations abaut the item which was clicked.

the second list view will not open quickly and the user have to wait a couple of seconds and I would like to add a ProgressBar circle in the first ListView near the item which was clicked.

How can I do this? I am using custom adapters for my lists.

I have this code to be executed in background:

final ListView lv3 = (ListView) findViewById(R.id.SubmissionLogsTable);
int prePosition = getIntent().getIntExtra("position", 1);
ArrayList<SubmissionLog_Database> submissionLogs = GetSubmissionLogs(prePosition);
lv3.setAdapter(new SubmissionLogListAdapter(this,submissionLogs));
Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265
  • I think it's better to start the new `Activity` and then show a `ProgressBar` with the loading status. – user Feb 20 '12 at 13:53
  • I have thinked on this too but I have some problems on how to do that. – Milos Cuculovic Feb 20 '12 at 13:55
  • Problems or not you have to do it. You have some problems with your code logic if the `Activity` takes seconds to start(also you could get a `Application Not Responding` notice). – user Feb 20 '12 at 14:01
  • In fact, i have 60 elements in my listView and this will take some time to get displayed, for that reason I would like to set the waiting notification. but how? – Milos Cuculovic Feb 20 '12 at 14:07

1 Answers1

2

Start a new activity passing some parameters you need and create your ListView using exectute method by the AsyncTask class, where you can set your progress bar just using onPreExectute method.

FrankBr
  • 886
  • 2
  • 16
  • 37