Number with Comma (9,999) It's very easy if you're using Sketchware Pro. Follow this: Just go to Blocks then Operator and then scroll down and choose toDecimalFormat and then type this ###,### inside the box of toDecimalFormat while the circle is the number value If you're not using Sketchware Pro. Follow this: Go to Activity and put this code textview1.setText(new DecimalFormat("###,###").format(25)); ###,### - To make the number format like 999,999,999,999 25 - Is the value
Get Percent of the Number By achieving the percentage of a number, divide the numbers and multiply it by 100. Example: Presidential Votes Bongbong Marcos gathered around 31,000,000 votes while his counterpart gathered only 14,000,000 and the people voted is more than 65,000,000. Bongbong Marcos - 31,000,000 Total Voters - 65,000,000 All you have to do is divide the two numbers (BBM votes and total votes) and multiply it by 100 to get the percentage of 100. 31,000,000 ÷ 65,000,000 = 0.476923076 0.476923076 × 100 = 47% Bongbong Marcos won the Presidential Election with 47% majority vote.
Get X, Y Position of Layout Detect the position of layout by following the steps. Step 1: Create two number variables, I'll name it x and y Step 2: Put this code: float x = Math.round(textview1.getX()); float y = Math.round(textview1.getY()); If you want to set the X, Y position of Layout follow this additional step. Step 3: textview1.setX((float)200)); textview1.setY((float)50));
Comments
Post a Comment