Null pointer exception error : database in android
<pre><code>package com.andrd.gps;

import com.android.util.Utils;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;

public class EditUserDetailActivity extends Activity{

    String strTruckType, strTruckPermit, strEmploymentType;
    EditText driverNameEdtxt,ageEdtxt,addressEdtxt,liecenceNoEdtxt,contactNoEdtxt,truckNoEdtxt,fromLocationEdtxt,toLocationEdtxt,longitudeEdtxt,latitudeEdtxt;
    LinearLayout addUserLayout, updateUserLayout;
    Button updateBtn,cancelBtn;
    UserDetail user;
    TransportData database;
    String strTruckNo;
    Spinner employmentTypeSpn, truckPermitSpn, truckTypeSpn;
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_user);

        user=new UserDetail();
        database=new TransportData(this);

        addUserLayout = (LinearLayout) findViewById(R.id.addUserlayout);
        addUserLayout.setVisibility(View.GONE);

        driverNameEdtxt = (EditText) findViewById(R.id.driverNameedtx);
        ageEdtxt = (EditText) findViewById(R.id.ageEdtxt);
        addressEdtxt = (EditText) findViewById(R.id.addressEdtxt);
        liecenceNoEdtxt = (EditText) findViewById(R.id.licenceNoEdtxt);
        contactNoEdtxt = (EditText) findViewById(R.id.contactNoEdtxt);
        truckNoEdtxt = (EditText) findViewById(R.id.truckNoEdtxt);
        fromLocationEdtxt = (EditText) findViewById(R.id.fromLocationEdtxt);
        toLocationEdtxt = (EditText) findViewById(R.id.toLocationEdtxt);
        longitudeEdtxt = (EditText) findViewById(R.id.longitudeEdtxt);
        latitudeEdtxt = (EditText) findViewById(R.id.latitudeEdtxt);






        Spinner employmentType = (Spinner) findViewById(R.id.DriverSpnr);
        employmentType.setAdapter(new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_spinner_item,Utils.driver_type));

        Spinner truckType = (Spinner)findViewById(R.id.TruckTypespnr);
        truckType.setAdapter(new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_spinner_item,Utils.truck_type));

        Spinner truckPermit = (Spinner) findViewById(R.id.TruckPermitSpnr);
        truckPermit.setAdapter(new ArrayAdapter&lt;String&gt;(this,
                android.R.layout.simple_spinner_item,Utils.truck_permit));
        truckPermit.setSelection(0);

        truckPermit.setOnItemSelectedListener(new OnItemSelectedListener(){
            @Override
            public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view,
                    int position, long arg3) {
                strTruckPermit = adapterView.getItemAtPosition(position).toString();
            }
            @Override
            public void onNothingSelected(AdapterView&lt;?&gt; arg0) {

            }
        });


        getUserData();

        updateBtn.setOnClickListener(new OnClickListener(){
            public void onClick(View v) {
                boolean ok = false;
                try {
                    user.driverName = driverNameEdtxt.getText().toString();
                    user.age = ageEdtxt.getText().toString();
                    user.liecenceNo = liecenceNoEdtxt.getText().toString();
                    user.address = addressEdtxt.getText().toString();
                    user.contactNo = contactNoEdtxt.getText().toString();
                    user.driverType = strEmploymentType;
                    user.truckNo = truckNoEdtxt.getText().toString();
                    user.truckPermit = strTruckPermit;
                    user.truckType = strTruckType;
                    user.fromLocation= fromLocationEdtxt.getText().toString();
                    user.toLocation = toLocationEdtxt.getText().toString();
                    user.latitude = latitudeEdtxt.getText().toString();
                    user.longitude = longitudeEdtxt.getText().toString();
                    int n = database.updateUser(user);
                    if(n&gt;0)
                    {
                        ok = true;
                    }

                } catch (Exception e) {
                    ok= false;

                }
                finally{
                    if(ok)
                    {

                        Toast.makeText(getApplicationContext(), "Successful update data", Toast.LENGTH_LONG).show();
                    }
                    else {
                        Toast.makeText(getApplicationContext(), "database Error", Toast.LENGTH_LONG).show();
                    }
                }

            }            
        });

        cancelBtn.setOnClickListener(new OnClickListener(){
            public void onClick(View v) {
                finish();

            }

        });
}
    private void getUserData() {

        user.truckNo = strTruckNo;
        try {
            database.getUserDetail(user);

            driverNameEdtxt.setText(user.driverName);
            ageEdtxt.setText(user.age);
            addressEdtxt.setText(user.address);
            liecenceNoEdtxt.setText(user.liecenceNo);
            contactNoEdtxt.setText(user.contactNo);
            employmentTypeSpn.setTag(user.driverType);
            truckNoEdtxt.setText(user.truckNo);
            truckTypeSpn.setTag(user.truckType);
            truckPermitSpn.setTag(user.truckPermit);
            fromLocationEdtxt.setText(user.fromLocation);
            toLocationEdtxt.setText(user.toLocation); 


        }
        catch (Exception e) {

            Toast.makeText(getApplicationContext(), "database Error", Toast.LENGTH_LONG).show();
        }

    }


    }
</code></pre>

<p>//error in line no 83(error name null pointer exception)</p>
