Skip to content

Instantly share code, notes, and snippets.

Created April 28, 2015 20:34
Show Gist options
  • Star 75 You must be signed in to star a gist
  • Fork 63 You must be signed in to fork a gist
  • Save anonymous/fa134c55a4a43e8d6004 to your computer and use it in GitHub Desktop.
Save anonymous/fa134c55a4a43e8d6004 to your computer and use it in GitHub Desktop.
/**
* 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));
}
@artjomHeim
Copy link

grafik

error: invalid method declaration; return type required
} displayPrice(2*5);
^

@SaiPrajoth
Copy link

don't why my app is crashing after clicking on the ORDER button

@shashankagrawal158
Copy link

error
How do I resolve this error?

@saurav-ux
Copy link

Code of [chetan081] approach

private void displayPrice(int number) {
TextView priceTextView = (TextView) findViewById(R.id.price);
priceTextView.setText("₹ "+ number);
}

@noah12binche
Copy link

android_errer
How do i resolve this error

@Saphiriela
Copy link

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