Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.github.faranjit:currency-edittext

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.faranjit:currency-edittext

A custom edittext for automatically formatting currency input

  • 1.0.1
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

Usage

These lines formats simply your input for default locale.

<faranjit.currency.edittext.CurrencyEditText
        android:id="@+id/edt_currency"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:textColor="@android:color/black" />

You can choose any locale.

<faranjit.currency.edittext.CurrencyEditText
        android:id="@+id/edt_currency"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:textColor="@android:color/black"
        app:locale="en_US" />

or

final CurrencyEditText currencyEditText = (CurrencyEditText) findViewById(R.id.edt_currency);
currencyEditText.setLocale(new Locale("en", "US"));

CurrencyEditText shows currency symbol depending on locale or you can set it not to show.

<faranjit.currency.edittext.CurrencyEditText
        android:id="@+id/edt_currency"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:textColor="@android:color/black"
        app:locale="en_US"
        app:showSymbol="false" />

or

currencyEditText.showSymbol(false);

If you want to change grouping and monetary seperators for money symbolization you can like this.

<faranjit.currency.edittext.CurrencyEditText
        android:id="@+id/edt_currency"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:textColor="@android:color/black"
        app:groupDivider="."
        app:monetaryDivider=","
        app:locale="en_US"
        app:showSymbol="true" />

or

currencyEditText.setGroupDivider('.');
currencyEditText.setMonetaryDivider(',');

When set text to 123450, this gives to output $1.234,50 instead of $1,234.50.

When you want to get double or String value of input it is enough to type these lines:

double d = currencyEditText.getCurrencyDouble();
String s = currencyEditText.getCurrencyText();

FAQs

Package last updated on 28 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc