It also works for me. Are you sure that you are not using NumberFormat2(1000000,0,0,2,False) on B4J?
Edit: You are right, this is what I get
B4X:
Log(NumberFormat2(1000000,0,0,2, False)) '1000000.00 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1000000.00 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1,000,000 on B4A Version 9.80
I was confused by inconsistency, but now I agree there is a Bug (hard to believe)! It shows up when you run these 3 lines on B4J.
B4X:
Log(NumberFormat(1000000,0,2)) '1,000,000 on B4J Version 8.10
Log(NumberFormat2(1000000,0,0,2,False)) '1000000.00 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1000000.00 on B4J Version 8.10
After some experimentation, it appears that when NumberFormat call comes after a NumberFormat2 call, the separator flag is not cleared.
B4X:
Log(NumberFormat2(1000000,0,0,2,False)) '1000000.00 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1000000.00 on B4J Version 8.10
Log(NumberFormat2(1000000,0,0,2,True)) '1,000,000.00 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1,000,000.00 on B4J Version 8.10
And the maximum fractions is also inherited!
B4X:
Log(NumberFormat2(1000000,0,2,0,False)) '1000000 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1000000 on B4J Version 8.10
Log(NumberFormat2(1000000,0,2,0,True)) '1,000,000 on B4J Version 8.10
Log(NumberFormat(1000000,0,2)) '1,000,000 on B4J Version 8.10
I'm away from my B4* products at the moment so I can't do any hands-on testing myself, but I have to ask if this could be explained by different regional settings on the Android device and the OS where the B4J app is run?
I would imagine that NumberFormat takes the regional settings account, isn't that correct? (The spec up top doesn't mention anything about this, but it seems very strange that it would always default to comma being used as a thousands separator.)
Yes, looking inside jCore.jar this seems to be this sems to be a bug in B4J. In B4A in Core.jar NumberFormat and NumberFormat2 use separate instances of a java.text.NumberFormat object when formatting numbers. In B4J they share a common single instance so NumberFormat inherits the latest Grouping and MinimumFractions settings from NumberFormat2!