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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:33:53+00:00 2026-05-31T02:33:53+00:00

here are my items public ArrayList<HashMap<String,String>> c_tmp= new ArrayList<HashMap<String,String>>(); public HashMap<String,String>mapa=new HashMap<String, String>(); String[]

  • 0

here are my items

public ArrayList<HashMap<String,String>> c_tmp= new ArrayList<HashMap<String,String>>();
 public HashMap<String,String>mapa=new HashMap<String, String>();
String[] name_Val = null;

Can anyone help me how to store in a String[] the following line name_Val

name_Val = (String[]) c_tmp.toArray(new String[c_tmp.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,name_Val);

I get this exception
java.lang.ArrayStoreException: source[0] of type Ljava/util/HashMap; cannot be stored in destination array of type [Ljava/lang/String;

  • 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-31T02:33:55+00:00Added an answer on May 31, 2026 at 2:33 am

    You are trying to flatten a map, which is a set of key/value pairs into a flat list of values. What’s supposed to happen to the keys here? Your c_tmp variable is a list of HashMaps, which is probably not what you want.

    If you only want the values from the map and you want to discard the keys, do this:

    List<String> strings = yourHashMap.values()
    

    You can then convert the List into an array should you so desire.

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

Sidebar

Related Questions

I have an ArrayList of string in my activity and i want to store
My activity is a ListActivity populated by an ArrayList<HashMap<String,String>> THREADS; I've also defined an
Here's the c# code that I have: private double get806Fees (Loan loan) { Loan.Fee.Items
I'm using sphinx to list me some items from my database here. It's almost
I'm trying to remove some items of a dict based on their key, here
I have a problem with sorting items in table in PHP. Here is what
here is my Arrival.java package one.two; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.app.ListActivity;
Here is my Arrival.java package one.two; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.app.ListActivity;
I want to retrieve object data from an ArrayList; public class Form1 { ArrayList
Here is my .java file: package com.shoppinglist; import java.util.ArrayList; import android.app.Dialog; import android.app.ListActivity; import

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.