October 25, 2014

Last Day at College (MCA)

Last Day at College (MCA)

  I walked with my best friends across the campus......... towards my class... my final year of  MCA class. The hour hand at the watch said ... it was ten minutes past 4.... and there was not even a single trace of any life in the college........ except for we three.... me and my best pals ...........
Another ten steps.. and there was our class with the doors shut... !!! we were on the ground floor... and the sun setting down in the valley with its orange rays was creating a magical scene. Had a wish that the time stops at that very moment... but it never happens... the seconds hand ticked heavily..... and we opened the doors of the class for one last time...................


          Wished i cud ask my teacher..."May i come in.... " and wanted to hear his shout.... "You late again... no attendance..." but there was no one there... just empty desks.. and we three.... looking at the walls.... and the desks.. all empty... with quotes we wrote ... and the  platform .. where the torture classes were held... and the last benches.. where we had fun.... laughed .... kicked out.... hiding from the teachers... pleading for attendance............ million memories rolled like a movie into our minds... and there was complete silence for a moment.. and we smiled ... laughed!!!!!

Walked like heroes from the medieval times.... jumped over the benches... had a look at the bench .. where the so called idiots of our class used to sit.... hehehe... ediots in MCA.... drifted to our place... ... sat there..... side seats... didn't feel like the last day .... don't remember how we met .... how we came to such a stage... feels like i know my friends from ages... feel like as if i was  in this college..... feel like i was always here...

The entire class was still there alive.... the last benches sleeping.......... the gals chatting amongst themselves........... the teacher in her own world...... Satish sitting besides me .... cribbing about something .... Yuvraj sitting in the second rotaking down notes.... we laughing about something of the other..... me occasionally scribbling something on my notepad............ making some sketches.. 

looked back..... but there was Satish .. in his dream world.... not scribbling anything in his notebook... not laughing this time.... not saying anything this time........... just sitting there.. and there was Shivkumar.. and there was me .....

the class has ended... and my friends... chatting and laughing .... going for a chai... aur a samossa..... aur a  coke... and we sat there ..... sat there all alone ......... closed our eyes, for the entire world outside the walls of the campus was calling us.............
.
Wanted to attend one last lecture........ but this time there was no one to take that last lecture..............and there was that door... open... and we wished all the time .. to run away .... to bunk.. but this time it wasn't..... one last time.... one last time............ attended the class.... with no one.. just we three...

Creating a Login Screen in Android

Login Screen in Android

In this post I will tell you how to create a Android Splash Screen which will display a ProgresBar for 5 seconds. Once the ProgressBar gets disappeared, the login screen will be displayed.

The output screen will look something like this

Creating Splash Screen in Android


Splash Screen in Android

In this post I will tell you how to create a Android Splash Screen which will display a ProgresBar for 5 seconds. Once the ProgressBar gets disappeared, the login screen will be displayed.

The output screen will look something like this

Splash Screen





















 Designing the Splash Screen

1. Create an Android project.

2. In the main.xml file add the following

    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content” />


3. In the MainActivity.java add the following code.


import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ProgressBar;

public class MainActivity extends Activity {

     static int progress;
     ProgressBar progressBar;
     int progressStatus = 0;
     Handler handler = new Handler();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        progress = 0;
        progressBar = (ProgressBar) findViewById(R.id.progressbar);
        //---do some work in background thread---
        new Thread(new Runnable()
        {
            public void run()
            {
              
                while (progressStatus < 10)
                {
                    progressStatus = doSomeWork();
                }
             
                handler.post(new Runnable()
                {
                    public void run()
                    {
                        Intent i = new Intent(getApplicationContext(), LoginActivity.class);
                        startActivity(i);
                        //---0 - VISIBLE; 4 - INVISIBLE; 8 - GONE---
                        progressBar.setVisibility(View.GONE);
                    }
                });
            }
            //---do some long running work here---
            private int doSomeWork()
            {
                try {
                    //---simulate doing some work---
                    Thread.sleep(500);
                } catch (InterruptedException e)
                {
                    e.printStackTrace();
                }
                return ++progress;
            }
        }).start();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
  
}

4. Create a new java class name it as LoginActivity.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class LoginActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // setting default screen to login.xml
        setContentView(R.layout.login);
     }
}

5. Add a new .xml file in the res/layout name it as login.xml

6. Modify the AndroidManifest.xml add the following

                    android:label="Login here">

7. Run the program.


More:  Designing a Login Screen in Android