Reputation: 75
i am using a service in order to play background music, and i want to create an on going notification with progress bar ,on status bar, in order to user can watch the progress of current track. Can somebody help me? Thank you very much ...
Upvotes: 0
Views: 2351
Reputation: 26925
Create a custom Notification
and put something like this in your notification_layout.xml file:
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="15dp"
android:id="@+id/notificationLoadingBar"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminate="false"
android:indeterminateOnly="false" />
Keep a reference to your Notification
(make it global) and set the progress using RemoteView
's API.
Sample code:
mNotification.contentView.setProgressBar(R.id.notificationLoadingBar,
max, progress, false);
Upvotes: 2