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 8883309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:46:58+00:00 2026-06-14T20:46:58+00:00

Is it possible to pass a File to AsyncTask? Like this? public class UploadImagesTask

  • 0

Is it possible to pass a File to AsyncTask? Like this?

public class UploadImagesTask extends AsyncTask<String, String, File> {
    @Override
    protected File doInBackground(String... params) {

and would I access that file by doing this?

params[2]
  • 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-06-14T20:47:00+00:00Added an answer on June 14, 2026 at 8:47 pm

    Not like that, no.

    If you want to pass in a String and a File, you’ll need to do something like this, and trust yourself not to screw up the arguments.

    public class DoThing extends AsyncTask<Object, String, File> {
        @Override
        protected File doInBackground(Object... params) {
            String stringy = (String) params[0];
            File file = (File) params[1];
            // do hard work
            return file;
        }
    }
    

    Since all your arguments extend Object, when you call the thing, it’ll look like this:

    String aString = stringGettingMethod();
    File aFile = fileGettingMethod();
    new DoThing().execute(aString, aFile);
    

    Alternately, you can pass whatever you want in through constructor arguments.

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

Sidebar

Related Questions

Is it possible to pass TargetActivity.class to another activity and do something like: //
I wanna know is this possible I pass get parameters for a javascript file
Is it possible to pass a secure KML file to Google Earth? This KML
Is it possible to upload a file to another server or pass a file
Is it possible to pass a variable to a linked .js file? I tried
Possible Duplicate: Pass a PHP string to a Javascript variable (including escaping newlines) Hy,
Is it possible to pass *args to string.format? I have the following function: @classmethod
tl;dr - I'd like to know if it is possible to pass an object
Possible Duplicate: Pass a PHP string to a Javascript variable (and escape newlines) I'm
I'm wondering if it is possible to pass form data from index.jsp file to

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.