android 自定义翻页符,在Android中以数千个分隔符(,)格式设置的“...

当我在editText中键入时,我想在EditText中使用千位分隔符(,).

之后,我将对数字进行一些操作.然后用千位分隔符(,)在TextView中显示结果.

这是我的代码:

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);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值