Добрый день, работая в связке с TextView + EditView (отображение текста (в 1), а точнее цифр, введенных в Edit (2)) приложение дописывает символ валюты, (если локация на устройстве RU - дописывает руб., если EN - дописывает $)
вопрос - как это убрать? чтобы приложение не дописывало ничего
пытался через Html.fromHtml - однако итог руб.+мойтекст
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.delari.myapplication2.MainActivity"
tools:showIn="@layout/activity_main"
android:columnCount="2"
android:useDefaultMargins="true"
>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/EditText"
android:layout_column="0"
android:digits="0123456789"
android:maxLength="6"
android:ems="10"
android:layout_columnSpan="2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/TextView"
android:layout_row="0"
android:layout_column="0"
android:layout_columnSpan="2"
android:background="@color/colorAccent"
android:layout_gravity="fill_horizontal"
/>
</GridLayout>
Activity
public class MainActivity extends AppCompatActivity {
private static final NumberFormat currencyFormat =
NumberFormat.getCurrencyInstance();
private TextView TextView;
private double Amount = 0.0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView = (TextView) findViewById(R.id.TextView);
EditText amountEditText =
(EditText) findViewById(R.id.EditText);
amountEditText.addTextChangedListener(EditTextWatcher);
}
private final TextWatcher EditTextWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count) {
try {
Amount = Double.parseDouble(s.toString()) / 100.0;
TextView.setText(currencyFormat.format(Amount));
}
catch (NumberFormatException e) {
TextView.setText("");
Amount = 0.0;
}
}
@Override
public void afterTextChanged(Editable s) { }
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) { }
};
}
В самом классе активите ничего подобного не указано (чтобы было добавление символов)
все стандартное инициализация, получение ссылок, слушатель TextWatcher который выводит текст в TextView полученный из EditView