Posts

Showing posts from June, 2017

Odd, Even and Prime No. from 1-150 in JAVA

public void main () { Log. e ("TAG", "main: Enter the number to check prime:"); checkPrime(); } public void checkPrime () { int i = 0; int num = 0; //Empty String String primeNumbers = ""; String evenNumbers = ""; String oddNumbers = ""; for (i = 1; i <= 150; i++) { int counter = 0; for (num = i; num >= 1; num--) { if (i % num == 0) { counter = counter + 1; } } if (counter == 2) { //Appended the Prime number to the String primeNumbers = primeNumbers + i + " "; } if (i % 2 == 0) { evenNumbers = evenNumbers + i + ", "; }else oddNumbers = oddNumbers + i + ", "; } System. out .println("Prime numbers from 1 to 150 are : " + primeNumbers ); System. out .println("Odd numbers from 1 to 150 are :

Using Roboto font android

src:  https://stackoverflow.com/questions/34444616/how-to-use-roboto-in-xml-layout Que: I hear it often nowadays: “Roboto is the default font type”. But how do I use this default font type? What I mean specifically is that in the old days when I used to download the assets, etc., I used to have to specify things like Ans: I've already found some possibilities Using  fontfamily The simplest way would be add  fontFamily  attribute to your specific  view  like  TextView According to  How to change fontFamily of TextView in Android From android 4.1 / 4.2 / 5.0, the following  Roboto  font families are available: android : fontFamily = "sans-serif" // roboto regular android : fontFamily = "sans-serif-light" // roboto light android : fontFamily = "sans-serif-condensed" // roboto condensed android : fontFamily = "sans-serif-thin" // roboto thin (android 4.2) android : fontFamily = "sans-serif-medium&quo