I have override this method in MyEditText class:
@Override
public Editable getText() {
Editable s = (Editable) super.getText();
s.toString().replace("$", "").trim();
return s;
}
MainActivity class is:
public class MainActivity extends Activity implements OnClickListener {
MyEditText myEditText;
Button btn;
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.try_layout);
myEditText = new MyEditText(this);
btn = (Button) findViewById(R.id.btn);
tv = (TextView) findViewById(R.id.tv);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
tv.setText(myEditText.getText().toString());
}
}
When i entered some values in edittext then click on btn nothing text is get from edittext why.