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

The Archive Base Latest Questions

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

I’m new to Android and trying to develop a simple android app. I’m trying

  • 0

I’m new to Android and trying to develop a simple android app. I’m trying to send two values from different activities as arguments to a third one. The problem is that the method that I’m using those two values, isn’t seeing the values that’s been entered by the user. Thanks in advance.
The code in that activity is:

public class NewAcount extends Activity {

    private DecimalFormat twoDigits = new DecimalFormat("0.00");
    TextView final_Amount;
    EditText price, amount_Entered;
    double userr_Entered_Amount, itemPricee, result;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.transparent);
        // amount of money the user wants to spend daily
        amount_Entered = (EditText) findViewById(R.id.et_Amount);
        // item price
        price = (EditText) findViewById(R.id.et_Price);

        final_Amount = (TextView) findViewById(R.id.tv_Account_Result);
        // set the text view value
        final_Amount.setText(twoDigits.format(getTotal()));

    }

    public double getItemPrice(double itemPrice) {
        this.itemPricee = itemPrice;
        System.out.println("the item price in the new account activity is "
                + itemPricee);

        return itemPricee;
    }

    public double getUserAmountEntered(double user_Entered_Amount) {

        this.userr_Entered_Amount = user_Entered_Amount;
        System.out.println("the user amount in the new account activity is "
                + userr_Entered_Amount);

        return userr_Entered_Amount;

    }

    public double getTotal() {
        // Here where the problem is. it's not seeing
        // userr_Entered_Amount and itemPricee
            // and returns result as zero

result=getUserAmountEntered(userr_Entered_Amount)-getItemPrice(itemPricee);

        System.out.println("the result is " + result);
        return result;
    }

}

FinanceAppActivity.java
I’m sending the amount entered doing:

    if (amount_Entered.getText().toString().length() > 0) {
        // start your expenses app activity
        Intent openYourExpensesActivity = new Intent(
                "android.intent.action.FINANCESQLLITE");
        startActivity(openYourExpensesActivity);
        double user_Entered_Amount=Double.parseDouble(amount_Entered.getText().toString());
        //send amount entered to new account activity           
        NewAcount na=new NewAcount();           
        na.getUserAmountEntered(user_Entered_Amount);
    }

YourExpenses.java
sending item price

    // to determine which button was clicked
    switch (v.getId()) {
    case R.id.btn_Add:
        boolean didItWork = true;
        try {
            String itemName = item.getText().toString();
            itemPrice = Double.parseDouble(price.getText().toString());         
            Price entry = new Price(YourExpenses.this);
            entry.open();
            // passing both strings to create entry method
            entry.creatEntry(itemName, itemPrice);  
            entry.close();
            NewAcount na=new NewAcount();
            //send item price to new account activity
            na.getItemPrice(itemPrice);
        } catch (Exception e) {
            //code here                 
        } finally {

            if (didItWork) {
                Dialog d = new Dialog(this);
                d.setTitle("Inserted successfully!");
                TextView tv = new TextView(this);
                tv.setText("Success");
                d.setContentView(tv);
                d.show();
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                Intent openNewAccount = new Intent("android.intent.action.TRANSPARENT");
                startActivity(openNewAccount);

            }
        }
  • 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-05T11:33:49+00:00Added an answer on June 5, 2026 at 11:33 am

    Are you just trying to call the public functions? This isn’t going to work because “typically” only one Activity has the foreground at a time. You can pass values with intents as extras, use a sharedpreference, of most extreme extend Application and use that to house all your data.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
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
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:

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.