Saturday, March 31, 2018

Thursday, March 22, 2018

Lovely Girly Qoutes Mo

$*#@%$ ca-app-pub-8895168001361953/4045419662




“No one can make you feel inferior without your consent.” –Eleanor Roosevelt


You see anyone can see a pretty girl, but its takes special people to see an old lady and to be able to see the pretty woman she must have been.

unknown



The prettiest girl could have low self-esteem because self-esteem is based on what SHE thinks of herself and not what others think.   

Sonya Parker


Beauty isn't about having a pretty face. It's about having a pretty mind, a pretty heart, & a pretty soul.
“If you are always trying to be normal, you’ll never know how amazing you can be.” – Maya Angelou


“And though she be but little, she is fierce.” – William Shakespeare

Put your hand on a hot stove for a minute and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute.

Albert Einstein

“The most effective way to do it, is to do it.” – Amelia Earhart

“If you really want to fly, just harness your power to your passion.” – Oprah.

“The future belongs to those who believe in the beauty of their dreams.” – Eleanor Roosevelt.

Beauty is not in the face; beauty is a light in the heart.   

Kahlil Gibran

“We cannot all succeed when half of us are held back. We call upon our sisters around the world to be brave – to embrace the strength within themselves and realize their full potential.” – Malala Yousafzai

“We can do no great things, only small things with great love.” – Mother Teresa

Not being beautiful was the true blessing. Not being beautiful forced me to develop my inner resources. The pretty girl has a handicap to overcome.

Golda Meir
“If you want something said, ask a man; if you want something done, ask a woman.” – Margaret Thatcher

“There are two ways of spreading light. To be the candle, or the mirror that reflects it.” – Edith Wharton
“I never dreamed about success. I worked for it.” – Estée Lauder

A great social success is a pretty girl who plays her cards as carefully as if she were plain.

F. Scott Fitzgerald

“No matter how plain a woman may be, if truth and honesty are written across her face, she will be beautiful.”- Eleanor Roosevelt

“Happiness and confidence are the prettiest things you can wear.” – Taylor Swift


True beauty in a woman is reflected in her soul. It is the caring that she lovingly gives, the passion that she knows.

Audrey Hepburn






Judge nothing by the appearance. The more beautiful the serpent, the more fatal its sting.   

William Scott Downey



Beauty always promises, but never gives anything.

Simone Weil



A beautiful girl can make you dizzy, like you been drinkin jack and coke all morning. she can make you feel high, for the single greatest comodity known to man - promise.

J. D. Salinger



It is a common phenomenon that just the prettiest girls find it so difficult to get a man.   

Heinrich Heine



The most beautiful face is face with a smile.

Anurag Prakash Ray
“The question isn’t who’s going to let me; it’s who is going to stop me.” – Ayn Rand
Just because something is beautiful doesn't mean it's good.

Alex Flinn
“Unique and different is the next generation of beautiful.” – Taylor Swift

“Beautiful people are not always good but good people are always beautiful.” -Imam Ali

“I’m not afraid of storms, for I’m learning to sail my ship.” – Louisa May Alcott

Just because something is beautiful doesn't mean it's good.

Alex Flinn

“I think beauty come from knowing who you actually are. That’s real beauty to me.” – Ellen DeGeneres

“She is clothed in strength and dignity, and she laughs without fear of the future.” – Proverbs 31:25
A woman's greatest asset is her beauty.

Alex Comfort



Beauty is power; a smile is its sword.

Charles Reade



Just because you're beautiful and perfect, it's made you conceited.   

William Goldman

“A girl should be two things: classy and fabulous.” – Coco Chanel

No matter how plain a woman may be, if truth and honesty are written across her face, she will be beautiful.   

Eleanor Roosevelt

“You are more powerful than you know; you are beautiful just as you are.” –Melissa Etheridge
“The power you have is to be the best version of yourself you can be, so you can create a better world.” –Ashley Rickards

How I feel about myself is more important than how I look. Feeling confident, being comfortable in your skin that's what really makes you beautiful.   

Bobbi Brown

“I can’t think of any better representation of beauty than someone who is unafraid to be herself.” ­–Emma Stone
No matter how plain a woman may be, if truth and honesty are written across her face, she will be beautiful.   

Eleanor Roosevelt
“You have what it takes to be a victorious, independent, fearless woman.” ­–Tyra Banks

“No matter what you look like or think you look like, you’re special, and loved, and perfect just the way you are.” ­–Ariel Winter
“Believe in yourself and you can do unbelievable things.” — Unknown


Beauty is only skin deep. I think what's really important is finding a balance of mind, body and spirit.

Jennifer Lopez
“Beauty begins the moment you decide to be yourself.” –Coco Chanel
“Be who you are and say how you feel, because those who mind don’t matter, and those that matter don’t mind.” –Dr. Seuss




Tuesday, March 6, 2018

Creating Notification in Android

Notifications
A notification is an short alert  message paved in the notification panel in Android device, for ex when a SMS is received on device you see a new SMS alert in the notification panel



Using notification you can inform or alerts user about some event.


Elements of Notification
1: Content Title: title of the notification.
2: Content Text: detail of notification.
3: Icon : Icon for the notification.








Creating  Notifications

Notifications are created using NotificationCompat.Builder and NotificationManager class.
NotificationCompat.Builder class is used to build the notification element and NotificationManager class is used to show the notification.
Building notification
NotificationCompat.Builder mBuilder =
                                        new NotificationCompat.Builder(context)
                                        .setSmallIcon(R.drawable.icon)
                                        .setContentTitle("Notification Title”)
                                        .setContentText(“Notification detail text”);

Showing notification
// create NotificationMAnager object
NotificationManager mNotificationManager =(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
int notificationId=1;
// notify using NotificationManger object
mNotificationManager.notify(notificationId, mBuilder.build());

Cancelling the notification
You need to cancel a shown notification when user has seen and clicked over it after dragging the notification panel.
to cancel the displayed notification
mNotificationManager.cancel(notificationId);

Demo Application : “Showing new SMS Notification”


What we will do : we will create a SMSReceiver class which extends BroadcastReceiver class. We register this class in manifest file as a receiver for “SMS_RECEIVED “ action. The onReceive() method of SMSReceiver class will execute when a new SMS is received on device.
In onReceive() method we extract the SMS body, and SMS Sender number from the received message. We create a notification and show that a new SMS received.
Note : Do not forget the to declare the “android.permission.RECEIVE_SMS” permission and SMSReceiver in manifest file. “android.permission.RECEIVE_SMS”  permission is required to receive SMS.



AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.notification"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
   
    <!-- Permission to Receive SMS  -->
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
       
        <!--  register the SMSReceiver -->
        <receiver android:name=".SmsReceiver">
            <intent-filter>
                <action android:name=
                    "android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>





SMSReceiver.java

public class SMSReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        //---get the SMS message passed in---
        Bundle bundle = intent.getExtras();       
        SmsMessage[] msgs = null;
        String SMSBody = "";           
        if (bundle != null)
        {
            //---retrieve the SMS message received---
           Object[] pdus = (Object[]) bundle.get("pdus");
            msgs = new SmsMessage[pdus.length];           
            for (int i=0; i<msgs.length; i++)

            {
                msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);               
                SMSBody += msgs[i].getMessageBody().toString();
            }

          // Get the Sender Phone Number
          String senderPhoneNumber=msgs[0].getOriginatingAddress ();
         
        //---display the new SMS message in toast---
          Toast.makeText(context, "SMS Revived from: "+senderPhoneNumber, Toast.LENGTH_SHORT).show();
         
        /* create the notification
         * set icon, title and text
         */
          NotificationCompat.Builder mBuilder =
                      new NotificationCompat.Builder(context)
                      .setSmallIcon(R.drawable.sms)
                      .setContentTitle("New SMS Recevied from: "+senderPhoneNumber)
                      .setContentText(SMSBody);
             

        // create NotificationMAnager object
       NotificationManager mNotificationManager =
                  (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
              int notificationId=1;
              // notify using NotificationManger object
              mNotificationManager.notify(notificationId, mBuilder.build());
             

       }                        
    }
}

Android Spinner Example


Spinner


Spinner is a widget which provides a quick way to select a value from a set. A spinner presents multiple options/items to the user from which user can select one option.
For ex.  In game application when we want user to select a particular level he/she wants to play, we can use spinner to multiples levels in which can select one level.



Using Spinner


Steps to use spinner in your application

1: Defining the spinner in your .xml/layout file by using “Spinner” tag
<!—Declaring Spinner in xml -->
    <Spinner
        android:id="@+id/spinner"
        android:layout_marginTop="20dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:prompt="@string/spinner_title"
    />

2: Create an array/arraylist of strings that will be set as the items of spinner.
String spinnerItems[]={"Level 1","Level 2","Level 3","Level 4","Level 5",};


3: Create adapter and set it with spinner
// Create adapter for spinner
ArrayAdapter  dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, spinnerItems);

// attaching data adapter to spinner
mySpinnerObject.setAdapter(dataAdapter);



4: Set  clicklistener on Spinner
// set clicklistener on Spinner
 mySpinnerObject.setOnItemSelectedListener(this);
5: override  onItemSelected() method, this method gets called by the System when an item is selected. This method receives the position parameter which signifies the index of the array/arraylist which is selected by the user.



@Override
 public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
                         
// get the selected Spinner's Item
            String itemSelected = parent.getItemAtPosition(position).toString();

}

Let put all this together and develop an android application to learn how to use spinner.


Demo Application: “Working with Spinner”

What we will do: We will present a list of levels “Level 1,Level 2,Level 3,Level 4,Level 5" to the user and show the level selected by the user using Toast.


activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">


    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Select the Level"
        android:layout_marginTop="20dp"
        android:textColor="#0000FF"
        android:textSize="20dp"
        android:textStyle="bold"
    />

    <!-- Spinner Element -->
    <Spinner
        android:id="@+id/spinner"
        android:layout_marginTop="20dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    />

  </LinearLayout>



SpinnerMainActivity.java

public class SpinnerMainActivity extends Activity implements OnItemSelectedListener
{
     Spinner mySpinner;
      /* create array of string of levels
     * to be set as Spinner Item
     */
    String spinnerItems[]={"Level 1","Level 2","Level 3","Level 4","Level 5",};
   
     @Override
     protected void onCreate(Bundle savedInstanceState)
     {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
         
          // get the Spinner reference
               mySpinner = (Spinner) findViewById(R.id.spinner);
       
               // set clicklistener on Spinner
               mySpinner.setOnItemSelectedListener(this);
       
              // Create adapter for spinner
          ArrayAdapter  dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, spinnerItems);

          // Drop down layout style - list view with radio button
                    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

          // attaching data adapter to spinner
          mySpinner.setAdapter(dataAdapter);
     }

     /* onItemSelected() method gets called by the System
      * when an item is selected
      * This method receives the position parameter
      * which signifies the index of the array
      * which is selected
      */
     @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
        {
           
              // get the selected Spinner's Item
              String itemSelected = parent.getItemAtPosition(position).toString();

              // Showing selected spinner item
              Toast.makeText(getApplicationContext(),  itemSelected+"  Selected", Toast.LENGTH_LONG).show();
          }
      
      
       @Override
          public void onNothingSelected(AdapterView view)
          {
              // TODO Auto-generated method stub
          }

}