Comments (3)
안녕하세요~ 유닛2 캠핑지기 남우진입니다. 위 hhyeok1026님께서 써주신 부분이 정답이 맞습니다!
return NumberFormat.getCurrencyInstance().format(tip)
로 되어있던 부분 중
getCurrencyInstance()에 들어갈 인자 값의 Default는 시스템의 locale로 맞춰있기 때문입니다.
예시: NumberFormat.getCurrencyInstance(Locale.getDefault()).format(price)
이에 따라 다음 같이 getCurrencyInstance의 인자 값으로 'Locale.US'를 추가해주시면 해당 문제는 깔끔히 해결이 됩니다!
return NumberFormat.getCurrencyInstance(Locale.US).format(tip)
추가적으로 Locale은 아래 스크린샷을 보시면 알 수 있듯이 JVM 인스턴스에 대한 Default Locale의 현재 값을 가져온다고 하네요! ㅎㅎ
from composecamp2022-for-beginners.
NumberFormat.getCurrencyInstance() 메서드가
휴대폰내의 setting - 언어에 대해서 통화가 표시 되는 것 같아요
아마도 앱 내에서 통화를 달러로 고정 시키려면, 파라미터 locale이 있는 메서드를 쓰면 될 듯하네요
https://developer.android.com/reference/java/text/NumberFormat#getCurrencyInstance(java.util.Locale)
- Q)
여기서 저도 추가적으로 궁금한게,
유닛 테스트 할 때도 원화로 표시가 되던데, 유닛 테스트에서는 어떻게 Default locale값을 가져오는지가 궁금하네요.
윈도우 세팅값을 자바에서 읽어오는 걸까요..?
from composecamp2022-for-beginners.
감사합니다. 궁금증이 해결됐네요.
from composecamp2022-for-beginners.
Related Issues (15)
- 예시) [Unit1][Create your first Android app] 관련 질문입니다. HOT 1
- [Unit1][Create your first Android app] 관련 질문입니다. HOT 6
- [Unit1][Create your first Android app] 관련 질문입니다. HOT 5
- [Unit1] Pathway3의 '텍스트 컴포저블로 간단한 앱 빌드' 코드랩 4~ 6과정 Theme 이름 HOT 1
- [Unit2][앱에 버튼 추가] 관련 질문입니다. HOT 2
- [Unit0][Git 사용하기] 관련 질문입니다. HOT 1
- [Unit1][매개변수 Modifier] 관련 질문입니다. HOT 4
- [Unit1][Android Studio] 관련 질문입니다. HOT 4
- [Unit2] Pathway3의 Calculating Tip섹션에서 번역 오류가 있습니다. HOT 3
- Unit2 ArtSpace 관련 질문입니다. HOT 1
- Modifier 적용 순서에 대한 질문입니다. HOT 3
- [Unit1] 코드랩 파일 실행 시 오류 HOT 3
- 번역 오류
- [Unit4][Reply app] Resizable (Experimental) 장치를 rotation할 때 발생하는 문제 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composecamp2022-for-beginners.