Posts

Shadow of ImageView in android

 Shadow of ImageView in android Gradle dependencies { compile 'com.yinglan.shadowimageview:shadowimageview:1.0.4' } In layout <com.yinglan.shadowimageview.ShadowImageView android:id="@+id/shadow" android:layout_width="300dp" android:layout_height="300dp" app:shadowRound="20dp" app:shadowSrc="@mipmap/lotus" app:shadowColor="@color/colorAccent"/> Set Picture shadow.setImageResource(resID); shadow.setImageDrawable(drawable); shadow.setImageBitmap(bitmap); Set the picture radius shadow.setImageRadius(radius); Set the shadow color of the image shadow.setImageShadowColor(color);

Divisibility

Image
Formulas for Divisibility Questions   Formulas for Divisibility in Aptitude A divisibility  is a rule for finding whether the number is divisible by another number or not. We can say that when number a is divided by another number b and remainder becomes zero . Hence the number a is divisible by b  . It is away to find factors of a large numbers.In this Page Formulas for Divisibility is given. Formulas for Divisibility & Definitions: A divisibility rule is a shorthand method of determining whether a given number is divisible by a fixed divisor without carrying out the division, usually by examining its digits. One whole number is divisible by another if, after dividing, the remainder is zero. If the whole number is divisible by another number than the second number is factor of 1st number.   Divisibility Formulas When we set up a division problem in an equation using our division algorithm, and  r  = 0, we have the  following equation: a = bq When this is the case, we say that  a  

23. Display a number in words even with tailing 0.

package com.company ; import java.util.Scanner ; public class Main { public static void main ( String [] args ) { Scanner scan = new Scanner( System . in ) ; System . out .println( "Enter a Number" ) ; int n = scan .nextInt() ; int r ; String str = "" ; while ( n > 0 ) { r = n % 10 ; n = n / 10 ; str = str + r ; } System . out .println( str ) ; char c ; for ( int i = str .length()- 1 ; i >= 0 ; i --) { c = str .charAt( i ) ; switch ( c ) { case '0' : System . out .print( "Zero " ) ; break ; case '1' : System . out .print( "One " ) ; break ; case '2' : System . out .print( "Two " ) ; b

22. Reverse the number and find number is Pallindrome or not.

Pallindrome Number : - If the reverse of the number is eqal to original number then , the number is pallindrome. ex:- original number = 121 , reverse number = = 121 therefore 121 is pallindrome. int r , n ; int rev = 0 ; Scanner sc = new Scanner( System . in ) ; n = sc .nextInt() ; int number = n ; // to not lost original number while ( n > 0 ) { r = n % 10 ; rev = rev * 10 + r ; n = n / 10 ; } System . out .println( rev ) ; if ( rev == number ) { System . out .println( "Number is pallindrome" ) ; } else System . out .println( "Number is not pallindrome" ) ;   output :-                        121                                121                                Number is pallindrome

21. Number is Armstonrg or not

       Armstorng no : If the sum of the digits of the cube of number is equal to original number then it is armstorng number .       ex : take number n = 153;           if  3*3*3 + 5*5*5 + 1*1*1 = 153 (i.e. same  number ,n )           then, the number is Armstorng number. int n , r ; int sum = 0 ; Scanner sc = new Scanner( System . in ) ; n = sc .nextInt() ; int store = n // to store the number ; while ( n > 0 ) { r = n % 10 ; sum = sum + r * r * r ; //sum of the cuber of the number n = n / 10 ; } System . out .println( sum ) ; if ( sum == store ) { System . out .println( store + " is Armstrong no" ) ; } else System . out .println( store + " is not Armstrong no" ) ; } 23564 440 23564 is not Armstrong no Process finished with exit code 0           

Toast in Android.

 Toast in Android.  /    SNACKBAR / (for permanent display notification can be used) sdfsdf / Toast . makeText ( MainActivity . this , "login Successfully" , Toast . LENGTH_SHORT ) . show(); Context context = getApplicationContext (); CharSequence text = "Hello toast!" ; int duration = Toast . LENGTH_SHORT ; Toast toast = Toast . makeText ( context , text , duration ); toast . show (); FOR STYLEABLE TOAST First implement latest dependency. dependencies { implementation 'io.github.muddz:styleabletoast:2.4.0' } Next, go to values -> style -> create new <style name = "signuptoast"> layout < style name ="signupToast" > < item name ="stColorBackground" > #228B22 </ item > < item name ="stTextBold" > true </ item > < item name ="stTextColor" > #fff </ item > < item name ="stFont" > @font/retrofont </ item