Search code examples
androidandroid-fragmentsactionbarsherlockandroid-progressbar

Fragments with header and download content


my first question here... so sorry for duplicates, but i didn't find an answer at all =(

I'm trying to create an app with 3 pages.

Main page - list of videos Bookmark page - list with all videos bookmarked settings page - settings and stuff

I first created it with 3 activities. It runs ok, but i found a problem when creating an asyncTask in Main page to download a video. The progress should appear in a progressBar in bookmark page. I thought about using roboSpice, but it seems more appropriate to use 3 fragments and a main activity (where the download would be made) instead of 3 activities.

So i went to actionBarSherlock, but then, another problem came up. I need a header with 2 buttons and a title. One button would call bookmark page and the other button would call settings.

It doesn't seem right to use actionBarSherlock to create a header by modifying the title, or even removing it, and just use the tabs.

Any ideas of how to implement this?

Examples would be nice!


Solution

  • Searching around i found a way to implement this using broadcast receiver and not using fragments, only activities.

    All i do is call a service in activity A, which opens my asyncTask to download the content and it broadcasts the result with the progress to activity B. Then, in activity B, i seek which view should show a progress bar and update the progress.

    I used this comment as a guide to my implementation.