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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:22:57+00:00 2026-05-31T19:22:57+00:00

I have a ListActivity and I want to set programmatically the text of a

  • 0

I have a ListActivity and I want to set programmatically the text of a TextView that is inside my layout, I need to do this to all my lines.

This TextView will show the Currency Simbol for the current Locale on each line of the ListActivity.

Code snippet:

DepositoRepository repo = new DepositoRepository(this);
Cursor c = repo.getCursor();
adapter = new SimpleCursorAdapter(this, R.layout.deposito_list, c,
    new String[] { Deposito.COLUNA_VALOR, Deposito.COLUNA_DATA },
    new int[] { R.id.tvValorDeposito, R.id.tvDataDeposito });
setListAdapter(adapter);

What I want for all rows:

Currency moeda = Currency.getInstance(Locale.getDefault());
TextView tvMoeda = (TextView)findViewById(R.id.tvMoeda);
tvMoeda.setText(moeda.getSymbol(Locale.getDefault()));
  • 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-31T19:22:58+00:00Added an answer on May 31, 2026 at 7:22 pm

    You can use a Custom Adapter to your listView. If you want I can edit my answer and show you how to do this. Here is something that can put you on a right track. Adapt this code to your application.
    And from your activity just call setListAdapter(adapter), adapter being your custom adapter.

    Hope this helps!

    EDIT:

    import java.util.Currency;
    import java.util.Locale;
    
    import android.content.Context;
    import android.database.Cursor;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.CursorAdapter;
    import android.widget.TextView;
    
    public class CustomAdapter extends CursorAdapter{
    
        public CustomAdapter(Context context, Cursor c) {
            super(context, c);
        }
    
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            Currency moeda = Currency.getInstance(Locale.getDefault());
            TextView tvMoeda = (TextView)view.findViewById(R.your_id);//your textView id here
            tvMoeda.setText(moeda.getSymbol(Locale.getDefault()));
        }
    
        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(context);
            View v = inflater.inflate(R.layout.item, parent, false);//your layout here
            bindView(v, context, cursor);
            return v;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two ListActivity classes that I want to pass into into a third
Currently I have a class that is extending the ListActivity class. I need to
I have a Pager adapter that will call a ListFragment like this: public Fragment
I have a listactivity which contains a listview. i want to show another layout
I have four tabs that hold four listviews, I want to set a background
I have a ListActivity and in it I set my list items with a
I have a ListActivity which has an adapter that crashes. Here is the code
I have the following XML layout for a ListActivity. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a ListView in a ListActivity populated with strings. However, only the text-part
I have a lisview that I want to add images to. The examples that

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.