-1

I am trying to make a chat window as in Whatsapp. At this point I am able to send chat message, image, audio, video. But I'm facing problem in downloading and uploading the Multimedia files. I'm using listview with custom adapter.

Suppose, My media is downloading, and keyboard popped up or I scroll up or down, then downloading stops. Multimedia is downloading in asynctask. My thinking is every time i scroll or keyboard popped up, adapter get refreshed, that's why downloading stops.

Now, My question is:

1- How whatsapp is doing this same scenario? Because It's downloading is not attached with activity. Even if we switch from activity, downloading still continues.

2- My adapter refreshed, that's why downloading stops. So, How would I make my adapter to not refresh the downloading part?

3- Or, Is there any other option better than list and adapter to achieve this scenario?

Thanks is advance.

Manish Kumar
  • 1,095
  • 9
  • 19

1 Answers1

0

for the all above said problems, you can use service instead of asyncTask.

the service still be there to complete your download even if you destroyed the activity. please go through the following links:

Need Help in Downloading in Background Images in Android?

http://www.vogella.com/tutorials/AndroidServices/article.html

https://developer.android.com/training/run-background-service/create-service.html

Community
  • 1
  • 1
Blue_Alien
  • 2,148
  • 2
  • 25
  • 29