Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Monday, August 27, 2012

Thread LifeCycle

Life Cycle of Thread :

thread's life cycle consists of five states:

New Thread : When an instance of a thread class is created, a thread enters the new thread state.        Thread newThread = new Thread(this);
                     You have to invoke the  Start( ) to start the thread.  ie, newThread.Start( );

Runnable : when the Start( ) of the thread is invoked the thread enters into the Runnable State.

sleep(long t);    where t= no: of milliseconds for which the thread is inactive.
The sleep( ) is a static method because it operates on the current thread.

Dead : A thread can either die natuarally or be killed.
A thread dies a natural death when the loop in the Run( ) is complete.
Assigning null to the thread Object kills the thread.
If the loop in the Run( ) has a hundred iterations , the life of the thread is a hundred iterators of the loop.

IsAlive( ) : it is used to determine wheather a thread has been started or stopped. If isAlive( ) returns true the thread is still running otherwise running completed.

Thread Priorities : are used by the thread scheduler to decide when each thread should ne allowed to run.To set a thread priority, use te setpriority( ), which is a member of a thread.
     final void setpriority(int level)     - here level specifies the new priority seting for the calling thread.

   The value level must be with in the range :-

Tuesday, August 21, 2012

GPS – Android

 LocationManager class provides the access to  know the location of the mobile. It will provide the current geo location to the user.
Here no need to instantiate the class directly, instead you can use Context.getSystemService(Context.LOCATION_SERVICE)

Android provides the   android.location package which provides the API to determince the current geo position.

LocationProvider is a super class of different location providers, which  will provide the current geo location.

We can get the location by using three methods,

Network  -  uses mobile network,wifi
Gps      -  uses mobile gps to find the location via satellites.
Passive  - allows to participate for getting location on other components to save the power.

To use the gps service in our android mobile, we need to declare permission in manifest file:

<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”/>

If your getting location by gprs we  need to declare
android.provider.Settings class provides to change the gps settings

LocationManager service = (LocationManager)getSystemService(LOCATION_SERVICE);
boolean enable = service.isProviderEnabled(LocationManager.GPS_PROVIDER);

We can check the gps enabled  by using if, else conditions
if (!enable)
 enable the gps by going to mobilesettings.

If we use  intents, we can directly goes to gps settings
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
Some constant methods:
public static final String GPS_PROVIDER
name of the gps provider. This will provide the location updates using satellites.
public static final String KEY_PROVIDER_ENABLED
it will hold the Boolean value when a provider enabled/disabled event is broadcast using a Pending Intent.
public static final String PROVIDERS_CHANGED_ACTION
Broadcast intent action when the configured location providers change.

Some public methods:
public GpsStatus getGpsStatus(GpsStatus status)
it will gives the information about current gps status.

Public LocationProvider getProvider (String name)
It gives the information associated with location provider of the given name
public Boolean isProviderEnabled(String provider)
Returns the current enabled/disabled status of the given provider.

public class MainActivity extends Activity implements LocationListener {

    TextView txtInfo;

    LocationManager lom;

    StringBuilder sb;

    int noOfFixes = 0;

    /** Called when the activity is first created. */


    public void onCreate(Bundle savedInstanceState) {




      //TextView to display gps data

        textdata = (TextView) findViewById(R.id.textView1);


        /* the location manager is the most vital part it allows access

         * to location and GPS status services */

        lom = (LocationManager) getSystemService(LOCATION_SERVICE);




    protected void onResume() {


       //  request updates every 1000ms or 10m


        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 100f, this);





    protected void onPause() {

        /* GPS, as it turns out, consumes battery like crazy */




    public void onLocationChanged(Location location) {

        Log.v(tag, "Location Changed");

        sb = new StringBuilder(512);



        /* display the data in the TextView */

        sb.append("No. of Fixes: ");




        sb.append("Londitude: ");



        sb.append("Latitude: ");



        sb.append("Altitiude: ");



        sb.append("Accuracy: ");



        sb.append("Timestamp: ");





    public void onProviderDisabled(String provider) {

        /*when the GPS is disabled in settings */

        Log.v(tag, "Disabled");

     //open gps settings

        Intent intent = new Intent(




    public void onProviderEnabled(String provider) {

        Log.v(tag, "Enabled");

        Toast.makeText(this, "GPS Enabled", Toast.LENGTH_SHORT).show();


    public void onStatusChanged(String provider, int status, Bundle extras) {

        /*  GPS status change */

        switch (status) {

        case LocationProvider.OUT_OF_SERVICE:

            Log.v(tag, "Status Changed: Not in service");

            Toast.makeText(this, "Status Changed: Not in Service",



        case LocationProvider.TEMPORARILY_UNAVAILABLE:

            Log.v(tag, "Status Changed: Temporarily Unavailable");

            Toast.makeText(this, "Status Changed: Temporarily Unavailable",



        case LocationProvider.AVAILABLE:

            Log.v(tag, "Status Changed: Available");

            Toast.makeText(this, "Status Changed: Available",






    protected void onStop() {

        /*saving the state is not important for this  app */






<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"



    android:layout_height="match_parent" >










we need to declare gps permission in manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"



    android:versionName="1.0" >



        android:targetSdkVersion="15" />




        android:theme="@style/AppTheme" >



            android:label="@string/title_activity_main" >


                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />





<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


Introduction To Object Oriented Programming

Java is a programming language for developing enterprise applications.
This language is evolved from Oak. It was developed by Sun Microsystems.
 Object-oriented programming  is a programming  uses "objects" and their interactions to design applications and computer programs.

Any OOP must support the following features.

Before going through all these, first learn
 What is  a class?
What is an Object?
class is the blue print from which an individual objects.
or simply we can say
A class is a collection of related data and related methods.

Instance of the class is known as Object.

i.e when we create an object memory will be assigned.
for example an engineer will give a plan to construct a building. With that plan, a constructor will build multiple buildings.

here plan is the class and its not existed really.

building is an object and it exists really.
Lets see the OOPS features:

Abstraction:  Showing the essential and hiding the non-Essential is known as Abstraction.


Encapsulation: The Wrapping up of data and functions into a single unit is known as Encapsulation.

     Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.


Inheritance: is the Process by which the Obj of one class acquires the properties of Obj’s another Class.

 A reference variable of a Super Class  can be assign to any Sub class derived from the Super class.

         Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.

Advantages: Reusability of code , accessibility of variables and methods of the Base class by the Derived class.


Polymorphism: The ability to take more that one form, it supports Method Overloading &  Method Overriding.

Friday, August 3, 2012

Mphasis Hiring Freshers in Hyderabad

Experience: 0 to 1 yrs

Shift: 24/7

Role: L1 - Infrastructure Support Engineer

Exp:  0-6 months

1) Bachelors degree in any technical stream with minimum of 60% on aggregate/ BSc Computers / BCA
2) Good Communication Skills
3) Knowledge on Operating Systems.
4) Knowledge on MS Office Suite
5) Willing to work in 24*7 shifts

1) Patching and Remediation on Wintel, Unix (Solaris, AIX and Linux)
2) Performing Prechecks
3) Performing Post Checks
Company Profile
MphasiS Limited
Grow and Win with MphasiS MphasiS consistently delivers Applications services, Infrastructure services, and Business Process Outsourcing (BPO) services globally through a combination of technology knowhow, domain and process expertise. We are over 40,000 professionals servicing clients across Banking & Capital Markets, Insurance, Manufacturing, Communications, Media & Entertainment, Healthcare & Life Sciences, Transportation & Logistics, Retail & Consumer Packaged goods, Energy & Utilities, and to Governments around the world. Our Differentiators * A company driven by ethics and strong values * Transparent working environment, flat, non-hierarchical structure and open door policy that promotes free flow of ideas, opinions, information and expertise * Provides a plethora of equal growth opportunities to all Mphasians * Fair recognition for performance and hard work * Conducive work place with easy accessibility for those with special needs * Building a better tomorrow by grooming our current leaders for the next level of leadership * Attract and retain individuals exhibiting talent in every possible perspective



Deloitte hiring freshers

Business Technology Analyst


  • Hyderabad, Andhra Pradesh

  • Delhi, Delhi

  • Bengaluru, Karnataka

  • Mumbai (Bombay), Maharashtra

Firm Service: Consulting

Reference Code: S14HCBTAST-MIT Mani

Type of Position: Full-time

 Apply here


Wednesday, August 1, 2012

NexWave, Logica,Lanxess,ENERCON Freshers openings 2011, 2012 B.Tech, B.E

NexWave Talent Management Solutions Private Limited hiring Freshers -2012

 Job Description

  • Any Engineering / MCA  Graduate with Good Programming Knowledge

  • 2012 Pass Outs are Only Preferred

  • Minimum 70% marks in X and XII/Minimum 65% in Graduation    

Selection Process & Program Cycle

Group Discussion 

Assessment Test 

 Self Sponsored Program 

Final Client Assessment  &  Deployment at Client's Location as Software Engineers

Apply here:



Logica Pvt Ltd

Support -Fresher 2011/2012

Job Description

Analysts will perform:

v  Almost zero touch installations of Operating system (OS)

v  Deployments and upgrades to OS

v  Package Images of software (as per client’s requirement)

v  Software auditing and license management

v  IT Asset management services

v  Patch management

v  Desktop Security solutions

Looking for 2011/ 2012 Fresher - BSc, BCA, BA, BCom, BBM, 3 years Diploma after 10th or 12th Std with 60% aggregate throughout  Academics (X, XII, Graduation, Diploma). Contract position.

 send resumes to:


 Lanxess India Pvt. Ltd 

Trainee - Java- Only Mumbai Candidates With 2012 Passout

Recruiter Name:

Ms. Neethi Srinivasan

Contact Company:

Lanxess India Pvt Ltd

send resumes to:



ENERCON hiring Icwa Fresher - 6 Opening(s)

 Experience 0 - 2 Years 

Industry Type Oil and Gas, Energy, Power, Infrastructure

Location Bengaluru/Bangalore, Hyderabad / Secunderabad, Pune, Tirunelveli, Vadodara/Baroda, Jaisalmer  

apply here:




20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts