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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:54:33+00:00 2026-06-05T21:54:33+00:00

I’m developing an Android application with a spinner. I have this problem: This is

  • 0

I’m developing an Android application with a spinner.

I have this problem:

enter image description here

This is spinner array adapter code:

public class OrderArticlesAdaper extends ArrayAdapter<Article>
{
    private Context mContext;
    private int layoutResourceId;
    private ArrayList<Article> articles;

    public OrderArticlesAdaper(Context context, int listItemResourceId,
            ArrayList<Article> dbArticles)
    {
        super(context, listItemResourceId, dbArticles);

        this.mContext = context;
        this.layoutResourceId = listItemResourceId;
        this.articles = dbArticles;
    }

    public ArrayList<Article> getArticles()
    {
        return this.articles;
    }

    @Override
    public int getCount()
    {
        return articles.size();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        Log.v("OrderArticlesAdaper", "getView.postion: " + position);
        View row = convertView;
        if (row == null)
        {
            LayoutInflater inflater = ((Activity)mContext).getLayoutInflater();
            row = inflater.inflate(layoutResourceId, parent, false);
        }

        Article article = articles.get(position);
        if (article != null)
        {
            TextView formNameView = (TextView)row.findViewById(android.R.id.text1);
            formNameView.setText(new Long(article.getArticleId()).toString());
        }
        return row;
    }
}

And this is an asynctask to load spinner data:

private class LoadEReportAsyncTask extends AsyncTask<String, Void, Boolean>
{
    private Context mContext;
    private ProgressDialog loadingDialog;
    private EReport eReport;
    private QAP qap;

    public LoadEReportAsyncTask(Context context)
    {
        Log.v("LoadEReportAsyncTask", "constructor");
        eReport = null;
        qap = null;

        this.mContext = context;
        loadingDialog = new ProgressDialog(mContext);
        loadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        loadingDialog.setMessage(getString(R.string.msg_loading_ereport));
        loadingDialog.setCancelable(false);
        loadingDialog.show();
    }

    @Override
    protected Boolean doInBackground(String... params)
    {
        Log.v("LoadEReportAsyncTask", "doInBackground");
        DBManager dbMan;
        dbMan = new DBManager(mContext);

        // Es un nuevo EReport, por lo tanto lo creo en la base de datos.
        if (eReportId == -1)
        {
            // Time In
            TextView aux = (TextView)((EReportFinalInspecActivity) mContext).findViewById(R.id.timeInVal);

            Calendar c = Calendar.getInstance();
            SimpleDateFormat df3 = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            String timeIn = df3.format(c.getTime());
            aux.setText(timeIn);

            eReport = new EReport();
            eReport.setOrderId(orderId);
            eReport.setQapId(qapId);
            eReport.setTimeIn(timeIn);

            eReportId = dbMan.insertEReport(eReport);
        }
        else
        {
            eReport = dbMan.getEReport(eReportId);
        }

        qap = dbMan.getQPA(params[0]);
        ordersArticles = dbMan.getOrderArticles(orderId);

        selectedArticles = new ArrayList<Article>(ordersArticles.size());

        return true; // TODO: Controlar los errores
    }

    protected void onPostExecute(Boolean result)
    {
        Log.v("LoadEReportAsyncTask", "onPostExecute");

        EReportFinalInspecActivity act = (EReportFinalInspecActivity) mContext;
        if (result)
        {
            Toast.makeText(getApplicationContext(), getString(R.string.msg_ereport_got_correct), Toast.LENGTH_SHORT).show();

            act.fillEReport(eReport, qap);
            Spinner articleSpin = (Spinner) act.findViewById(R.id.articlesSpiner);
            OrderArticlesAdaper spinAdapter = new OrderArticlesAdaper(mContext, android.R.layout.simple_spinner_item, ordersArticles);
            spinAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            articleSpin.setAdapter(spinAdapter);

            // TODO: Esto hay que cambiarlo porque siempre habrá QAP.
            if (qap != null)
                act.eReportHasQAP(true, qap.getName());
            else
                act.eReportHasQAP(false, null);
        }
        else
        {
            Toast.makeText(getApplicationContext(), getString(R.string.msg_ereport_problem), Toast.LENGTH_LONG).show();
        }

        loadingDialog.dismiss();
    }
}

What am I doing wrong?

  • 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-05T21:54:35+00:00Added an answer on June 5, 2026 at 9:54 pm

    Try:

    formNameView.setText(Long.toString(article.getArticleId()));
    

    Edit:

    This is just a guess, but maybe Android is filling the spinner dropdown textviews using Article.toString(), since your adapter handles objects of type Article.

    To test this, override toString in your Article class.

    public class Article {
        ...
        @Override
        public String toString() {
            mArticleId.toString(); // This is the private field holding the long id.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.