Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5995181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:55:25+00:00 2026-05-22T23:55:25+00:00

The Android documentation has an example for using AsyncTask, in this example the DownloadFilesTask

  • 0

The Android documentation has an example for using AsyncTask, in this example the DownloadFilesTask class extends AsyncTask in a rather odd way (for a beginners perspective at least):

private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {

Shouldn’t AsyncTask be accepting type variables instead of primitive types? And what happens if I want to input strings in all 3 parameters? Like so:

private class DownloadFilesTask extends AsyncTask<String, String, String> {

How does the class then reference these parameters individually?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:55:26+00:00Added an answer on May 22, 2026 at 11:55 pm

    Those generic typs only define what kind of input types you have for <Param, Progress, Result> meaning that all the params to execute() are of type Param, those for onProgressUpdate are of Progress and that doInBackground() will return something of type Result. The generics only define the type of stuff that is expected later.

    If you have a decent IDE, when you define the class X extends AsyncTask<...> it will provide you with the callbacks where all the right types are filled in.

    In your 2nd example — that does not mean that execute() expects 3 Strings – actually it expects one or more variables of type Param, as it is a varargs signature. Within the method, you would then reference the individiual instances like accessing an array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone managed to use ItemizedOverlays in Android Beta 0.9? I can't get it
The developer documentation has seemed to have failed me here. I can create a
The Android SDK has some convenience methods for manipulating data with SQLite. However both
Has anyone successfully compiled the android kernel and tested it in the Android emulator,
I've been reading the android documentation on reflection, but i'm just not really grasping
The documentation is somewhat scarce, but my search has not turned up anything but
I have been reading the Android documentation and I am wondering if anyone can
In Android, when layout out widgets, what's the difference between fill_parent ( match_parent in
I'm doing some Android development, and I much prefer Visual Studio, but I'll have
I'm building an Android app and I want to copy the text value of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.