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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:51+00:00 2026-06-10T13:15:51+00:00

I am trying to change the value of one editview while there is change

  • 0

I am trying to change the value of one editview while there is change in another editview even if the program runs value is not passed to editview.Value is passes from one edit view to another and then the value is multiplied by parsed value. help my main activity code is:

public class Main extends ListActivity {
public double C_webuserDouble;
public double C_cashDouble;
public double C_transferDouble;

public double S_webuserDouble;
public double S_cashDouble;
public double S_transferDouble;

EditText resultTxt ;
TextView cashTxtView ;
TextView webuserTxtView;
TextView transferTxtView;
TextView S_cashTxtView ;
TextView S_webuserTxtView;
TextView S_transferTxtView;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listplaceholder);

    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();


    JSONObject json = JSONfunctions.getJSONfromURL("http://ldsclient.com/ftp/strtojson.php");

    try{

        JSONArray  netfoxlimited = json.getJSONArray("netfoxlimited");

        for(int i=0;i<netfoxlimited.length();i++){                      
            HashMap<String, String> map = new HashMap<String, String>();    
            JSONObject e = netfoxlimited.getJSONObject(i);

            map.put("date",  e.getString("date"));
            map.put("c_web", e.getString("c_web"));
            map.put("c_bank",e.getString("c_bank"));
            map.put("c_cash",  e.getString("c_cash"));
            map.put("s_web",   e.getString("s_web"));
            map.put("s_bank",e.getString("s_bank"));
            map.put("s_cash", e.getString("s_cash"));
            mylist.add(map);        

        /** C_webuserDouble=json.getDouble("c_web");
            C_transferDouble= json.getDouble("c_bank");
            C_cashDouble=json.getDouble("c_cash");


            S_webuserDouble=json.getDouble("s_web");
            S_transferDouble= json.getDouble("s_bank");
            S_cashDouble=json.getDouble("s_cash");*/

        }       
    }catch(JSONException e)        {
         Log.e("log_tag", "Error parsing data "+e.toString());
    }

    ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main, 
                    new String[] {"date", "c_web" ,"c_bank","c_cash","s_web" ,"s_bank","s_cash",}, 
                    new int[] { R.id.item_title,R.id.webuserTxtView, R.id.transferTxtView, R.id.cashTxtView, R.id.S_webuserTxtView, R.id.S_transferTxtView, R.id.S_cashTxtView});

    setListAdapter(adapter);
    resultTxt = (EditText) findViewById(R.id.editText1);
    resultTxt.addTextChangedListener(new TextWatcher(){

        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub

            String text;
            text=resultTxt.getText().toString();
            if(resultTxt.getText().length()>0){
calculateSum(C_webuserDouble,C_cashDouble,C_transferDouble);
                    calculateSunrise(S_webuserDouble,S_cashDouble,S_transferDouble);
            }

}

        public void beforeTextChanged(CharSequence arg0, int arg1,
                int arg2, int arg3) {
            // TODO Auto-generated method stub

        }

        public void onTextChanged(CharSequence s, int start, int before,
                int count) {
            // TODO Auto-generated method stub

        }});}

private void calculateSum(Double webuserDouble, Double cashDouble, Double transferDouble){

    String Qty;
    Qty= resultTxt.getText().toString();



    if(Qty.length() >0){
    double QtyValue = Double.parseDouble(Qty);
    double cashResult;
    double webuserResult;
    double transferResult;

    cashResult =  cashDouble * QtyValue;
    webuserResult = webuserDouble * QtyValue;
    transferResult = transferDouble * QtyValue;

    DecimalFormat df = new DecimalFormat("#.##");
    String cashResultStr = df.format(cashResult);
    String webuserResultStr = df.format(webuserResult);
    String transferResultStr = df.format(transferResult);

    cashTxtView.setText(String.valueOf(cashResultStr));
    webuserTxtView.setText(String.valueOf(webuserResultStr));
    transferTxtView.setText(String.valueOf(transferResultStr));


    //cashTxtView.setFilters(new InputFilter[] {new DecimalDigitsInputFilter(2)});
}

    if(Qty.length()==0){
        cashTxtView.setText(String.valueOf(cashDouble));
        webuserTxtView.setText(String.valueOf(webuserDouble));
        transferTxtView.setText(String.valueOf(transferDouble));

    }

}

private void calculateSunrise(Double webuserDouble, Double cashDouble, Double transferDouble){

String Qty;
    Qty= resultTxt.getText().toString();



    if(Qty.length() >0){
    double QtyValue = Double.parseDouble(Qty);
    double cashResult;
    double webuserResult;
    double transferResult;

    cashResult =  cashDouble * QtyValue;
    webuserResult = webuserDouble * QtyValue;
    transferResult = transferDouble * QtyValue;

    DecimalFormat df = new DecimalFormat("#.##");
    String cashResultStr = df.format(cashResult);
    String webuserResultStr = df.format(webuserResult);
    String transferResultStr = df.format(transferResult);

    S_cashTxtView.setText(String.valueOf(cashResultStr));
    S_webuserTxtView.setText(String.valueOf(webuserResultStr));
    S_transferTxtView.setText(String.valueOf(transferResultStr));
    }

    if(Qty.length()==0){
        S_cashTxtView.setText(String.valueOf(cashDouble));
        S_webuserTxtView.setText(String.valueOf(webuserDouble));
        S_transferTxtView.setText(String.valueOf(transferDouble));

    }

 }


}

Following is my listplaceholder code

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">    

<ListView
    android:id="@id/android:list"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:drawSelectorOnTop="false" />

<TextView
    android:id="@id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="No data"/>

</LinearLayout>

all the code are same but following logcat error generates when user input is given

08-29 14:53:01.234: E/AndroidRuntime(2206): Uncaught handler: thread main exiting due to uncaught exception
08-29 14:53:01.245: E/AndroidRuntime(2206): java.lang.NullPointerException
08-29 14:53:01.245: E/AndroidRuntime(2206):     at com.mokshya.jsonnetfoxtab.Main.calculateSum(Main.java:142)
08-29 14:53:01.245: E/AndroidRuntime(2206):     at com.mokshya.jsonnetfoxtab.Main.access$0(Main.java:120)
08-29 14:53:01.245: E/AndroidRuntime(2206):     at com.mokshya.jsonnetfoxtab.Main$1.afterTextChanged(Main.java:101)
  • 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-10T13:15:52+00:00Added an answer on June 10, 2026 at 1:15 pm

    Change your xml to that

    <TextView     
    android:id="@+id/editText1     
    android:layout_width="fill_parent"     
    android:layout_height="wrap_content"     
    android:text="No data"/> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to change the focus from one textbox to another while the
I'm trying to change the value in one textfield from the value of another
I am trying to change a value in a table from one view, and
I am trying to change the value of onclick of a td from a
I'm trying to change the value of a BooleanField in one of my models,
I'm trying to change my WHERE clause based on the value of one column
I'm trying to change the value on the page while when loaded and changing
I trying to change background of one button when another button clicked. i can't
I am trying to Change the value of an Object's property (Unarchived from .plist)
I have a simple jsfiddle where i am trying to change value of each

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.