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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:21:56+00:00 2026-06-17T11:21:56+00:00

I have an Asynctask setup I pass an Arraystring like this ArrayList<String> creds =

  • 0

I have an Asynctask setup I pass an Arraystring like this

ArrayList<String> creds = new ArrayList<String>();
creds.add(string1);
creds.add(string2);
new myasynctask().execute(creds);

asynctask method
class myasynctask extends AsyncTask<ArrayList, Integer , String>

DOinbackground

protected String doInBackground(ArrayList<String>... creds) 

            {       String lol1= creds[0].toString();
                    String lol2= creds[1].toString();
........rest of the code
                                
}

I get an Array index out of bond exception
how do I pass tow values into the doinbackground method and get both of them at once.

  • 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-17T11:21:56+00:00Added an answer on June 17, 2026 at 11:21 am

    you can get value by this code

    class test extends AsyncTask<ArrayList<String>, Void, Void>
    {
    
    @Override
    protected Void doInBackground(ArrayList<String>... creds) {
        // TODO Auto-generated method stub
        String str1 = creds[0].get(0);
        String str2 = creds[0].get(1);
    
        return null;
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AsyncTask inside an Service which is trying to pass a ArrayList
i have a class extends asynctask private class taskMK extends AsyncTask<Void,Void,JSONObject>{ String url; JSONObject
I am using an ListAdapter to populate a ListView like this: static final String[]
I have an AsyncTask that handles a rather long download, using HttpClient. I'd like
I have classic AsyncTask to load image: private class DownloadImageTask extends AsyncTask<String,Void,Bitmap> { Bitmap
I have an asynctask that is in its own activity. I pass it a
So I have this AsyncTask that loads a WebView in onPostExecute that otherwise works
I have an AsyncTask which never dies. The listener to the events in this
I have an AsyncTask and on the background I want to start Service that
I have an AsyncTask with a textview loaded in the class so it looks

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.