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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:02:51+00:00 2026-06-07T16:02:51+00:00

Hello i am trying to set a content description to my button buy when

  • 0

Hello i am trying to set a content description to my button buy when i try to access to it the value that return to me is null.

Here is the code of the button.

//This is the button of the payment.
ImageButton make_pay = new ImageButton(this);
make_pay.setBackgroundResource(R.drawable.add_product);
makePay.addView(make_pay);
makePay.setContentDescription("Precio");

This is the code that i use to access:

make_pay.setOnClickListener(new View.OnClickListener() {                                        

        @Override
        public void onClick(View makepay) {
            LinearLayout wrap_area = (LinearLayout)findViewById(R.id.division2);
            TextView test = new TextView(FrontActivity.this);
            wrap_area.addView(test);
            if (makepay.getContentDescription() == null){
                    test.setText("Precio:1");
            }else{
                    test.setText(makepay.getContentDescription().toString());
            }
        });
}
  • 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-07T16:02:53+00:00Added an answer on June 7, 2026 at 4:02 pm

    You are setting the content description to makePay object (whatever it is, probabbly a ViewGroup). But then, you are setting the listener to the make_pay ImageButton, which is the one received by the listener arguments. Thus, it’s content description is not the one assigned to the other object.

    Try changing this:

    makePay.setContentDescription("Precio");
    

    with this:

    make_pay.setContentDescription("Precio");
    

    Anyway, try not to name your objects in such a similar way. It could lead to big confussions.

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

Sidebar

Related Questions

Hello people of stackoverflow. I have a problem. I'm trying to set up my
Hello I been trying to figure out how to set up ASP.Net forms authentication
hello guys i am trying to print title from a set of urls in
Hello im trying to echo only the 50 letters, but something in my code
Hello I was trying to remove objects from object array that I have and
Hello guys. I trying set EditText to input only numbers and point ( .
Hello I'm trying to set attributes for a viewcontroller nested inside a NSMutableArray, for
I'm trying to set up a javascript front in that is consuming JSON from
Hello all i have a button i am trying to let users share a
I am trying to set up an email function that will email the last

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.