I want a thousands separator (,) in EditText when i am typing in editText. after that,i will do some operation on the number.then show the result in the TextView by thousands separator (,).
this is my code:
public class Mainactivity extends Activity {
/** Called when the activity is first created. */
EditText edt;
TextView txt;
Button btn;
OnClickListener myclick = new OnClickListener() {
@Override
public void onClick(View arg0) {
// my calculation
double num1 = Double.parseDouble(edt.getText().toString());
double num2 = num1 + 7;
txt.setText("" + num2);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
edt = (EditText) findViewById(R.id.edt);
txt = (TextView) findViewById(R.id.txt);
btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(myclick);
}
}