Created
April 28, 2015 20:34
-
-
Save anonymous/fa134c55a4a43e8d6004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This method displays the given price on the screen. | |
*/ | |
private void displayPrice(int number) { | |
TextView priceTextView = (TextView) findViewById(R.id.price_text_view); | |
priceTextView.setText(NumberFormat.getCurrencyInstance().format(number)); | |
} |
Code of [chetan081] approach
private void displayPrice(int number) {
TextView priceTextView = (TextView) findViewById(R.id.price);
priceTextView.setText("₹ "+ number);
}
After latest update of Android studio it should be this code in Kotlin:
/**
* This method displays the given price on the screen.
*/
private fun displayPrice(number: Int) {
val priceTextView = findViewById(com.example.justjava.R.id.price_text_view) as TextView
priceTextView.setText(java.text.NumberFormat.getCurrencyInstance().format(number))
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
don't why my app is crashing after clicking on the ORDER button