Monday, April 30, 2018

Android Spinner Example

$*#@%$ ca-app-pub-4111868940087848/9468577869
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
          }

}




Monday, April 16, 2018

Thoughts New for Successful life Mo

$*#@%$ ca-app-pub-4111868940087848/1719191536



Inspitaional Thoughts for Life








































































































Saturday, March 31, 2018

Day Wishes Mo

$*#@%$ ca-app-pub-4111868940087848/2124211796



Day Wishes Images and Quotes










































































Thursday, March 22, 2018

Lovely Girly Qoutes Mo

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




“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