2

This is my code

private void displayPrice(int number) {
        TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
        priceTextView.setText(NumberFormat.getCurrencyInstance().format(number));
    }}

I am getting Cannot Resolve symbol"Number Format".

Harish S
  • 49
  • 1
  • 5

3 Answers3

4

You should import the NumberFormat class from java.text

Your import statement should like below.

import java.text.NumberFormat
Bhuvanesh BS
  • 13,474
  • 12
  • 40
  • 66
4

Import this its working

import java.text.NumberFormat;
Anil
  • 1,605
  • 1
  • 14
  • 24
1

Try to include the line

import.java.text.NumberFormat

manually.

Krisztián Balla
  • 19,223
  • 13
  • 68
  • 84
devashish
  • 11
  • 1