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

  • Home
  • SEARCH
  • 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 6697977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:31:26+00:00 2026-05-26T06:31:26+00:00

I decided to learn a little bit android progrramming and by using Eclipse +

  • 0

I decided to learn a little bit android progrramming and by using Eclipse + android plug-in I made an android “hello world” application. After that I tryed something simple and used 3 TextViews:

ID:TextView1 String-Value:A=5
ID:TextView2 String-Value:B=10
ID:TextView3 String-Value:A+B=C=

I created them in main.xml menu by drag and drop so, to show them I’m using the flowing line:

setContentView(R.layout.main);

The Question is: I want to get string values of A and B and append the result of 5+10 to the string value of C actualy I did it but it take too much codes just for get str value of a TextView and editing it. Is there any short way like in .Net?

string Str = This.Label1.Text();

And is eclipse is the best IDE or am I should use something else?
When I have several textviews etc, Why am I should write unnecessary lines if there is a short way to do it.

Another Question is I get str-value of B which is 10 but when I tryed the same thing for A it says there is nothing inside VarAStr
*My Codes are:*

setContentView(R.layout.main);

TextView VarAStr = (TextView)findViewById(R.id.VarA);
TextView VarBStr = (TextView)findViewById(R.id.VarB);
TextView VarC = (TextView) findViewById(R.id.VarC);

try{
    int VarA=Integer.parseInt(VarAStr.getText().toString().substring(2));
    int VarB=Integer.parseInt(VarBStr.getText().toString().substring(2));
    VarC.append(String.format("%d", (VarA+VarB)));
}
catch(Exception e){
    Toast.makeText(this, e.toString() + "   -" + VarAStr.getText().toString() + "-", Toast.LENGTH_LONG).show();//Show(); 
}

For the last question I found a bad code line in main.xml 🙂 wich has no android:text=”@string/VarA” I added this and problem solved.

Thank you for any respond.

  • 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-26T06:31:26+00:00Added an answer on May 26, 2026 at 6:31 am

    You can always put the repeated code on a function that returns a string.

    Something like:

    public String getTextOfView(int id) {
        TextView tmp = (TextView)findViewById(id);
        return tmp.getText.toString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a Mac user and I've decided to learn Emacs. I've read that to
I'm an old (but not too old) Java programmer, that decided to learn C++.
I've recently decided that I just have to finally learn C/C++, and there is
A little background: as a way to learn multinode trees in C++, I decided
I've decided to look into Clojure (inspired by this book ). After a bit
Good day. I decided to learn Java. I installed JDK and downloaded eclipse-java-helios-SR1-win32 for
After programming for a while in C, I decided to finally start to learn
I recently decided to learn and make small 2D game using XNA framework. So
When I decided to learn Ruby a short while ago I also decided that
Now that I am quite familiar with Python, decided to learn C++, so I

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.