FATAL EXCEPTION: main (during exit application)
<p>I am new to Android development. When I start my application, everything is smooth, but when I try to exit the application, the application suddenly crashes, and I get <code>FATAL EXCEPTION: main</code> in the LogCat. Can any of you can help me solve the problem? Thanks!</p>

<p>Here is the full LogCat:</p>

<pre><code>06-01 11:26:42.217: W/dalvikvm(17083): threadid=1: thread exiting with uncaught exception (group=0x40f19258)
06-01 11:26:42.221: E/AndroidRuntime(17083): FATAL EXCEPTION: main
06-01 11:26:42.221: E/AndroidRuntime(17083): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.uangel.suishouji/com.uangel.suishouji.MainActivity}: java.lang.NullPointerException
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.os.Looper.loop(Looper.java:154)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread.main(ActivityThread.java:4624)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at java.lang.reflect.Method.invokeNative(Native Method)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at java.lang.reflect.Method.invoke(Method.java:511)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at dalvik.system.NativeStart.main(Native Method)
06-01 11:26:42.221: E/AndroidRuntime(17083): Caused by: java.lang.NullPointerException
06-01 11:26:42.221: E/AndroidRuntime(17083):    at com.uangel.suishouji.MainActivity.initInfo(MainActivity.java:207)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at com.uangel.suishouji.MainActivity.onCreate(MainActivity.java:70)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.Activity.performCreate(Activity.java:4479)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
06-01 11:26:42.221: E/AndroidRuntime(17083):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
06-01 11:26:42.221: E/AndroidRuntime(17083):    ... 11 more
</code></pre>

<p>And the code:</p>

<pre><code>import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import com.uangel.suishouji.db.MyDbHelper;
import com.uangel.suishouji.utility.MyProcessBar;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    private final int DATE_MOTH_DAY = 1;
    private final int DATE_DAY = 2;
    private MyDbHelper db = null;
    private Calendar calendar = Calendar.getInstance();
    private String year = null;
    private String month = null;
    private String day = null;
    private String weekStart = null;
    private String weekEnd = null;
    private int income_amount = 0;
    private int expense_amount = 0;

    private Button add_expense_quickly_btn = null;
    private TextView month_tv = null;
    private TextView income_amount_tv = null;
    private TextView expense_amount_tv = null;
    private TextView budget_balance_amount_tv = null;
    private TextView date_of_month_tv = null;
    private TextView today_datestr_tv = null;
    private TextView today_expense_amount_tv = null;
    private TextView today_income_amount_tv = null;
    private TextView week_datestr_tv = null;
    private TextView week_expense_amount_tv = null;
    private TextView week_income_amount_tv = null;
    private TextView month_datestr_tv = null;
    private TextView month_expense_amount_tv = null;
    private TextView month_income_amount_tv = null;

    private MyProcessBar myProcessBar = null;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK){
            initInfo();
        }
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);
        initDate();
        loadingFormation();
        initInfo();
    }

    /*
     * (non-Javadoc)
     * 
     * @see android.view.View.OnClickListener#onClick(android.view.View)
     */
    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Intent in = null;
        if (v == add_expense_quickly_btn) {
            in = new Intent(MainActivity.this, TransactionTabActivity.class);
            startActivity(in);
            finish();
        }

        long curtime = getCurrentTime();
        switch (v.getId()) {
        case R.id.today_row_rl:
            showNavExpenseActivity(curtime, curtime, getString(R.string.text_title_today), NavExpenseActivity.mode_day);
            break;
        case R.id.week_row_rl:
            showNavExpenseActivity(getFirstOfWeek(curtime), getLastOfWeek(curtime), getString(R.string.text_title_week), NavExpenseActivity.mode_week);
            break;
        case R.id.month_row_rl:
            showNavExpenseActivity(getFirstOfMonth(curtime), getLastOfMonth(curtime),getString(R.string.text_title_month), NavExpenseActivity.mode_month);
            break;
        case R.id.nav_account_btn:
            startActivity(new Intent(this, SettingAccountActivity.class));
            break;



        }

    }

    private void showNavExpenseActivity(long startTime, long endTime, String title, int mode)
    {
        Intent intent = new Intent(this, NavExpenseActivity.class);
        intent.putExtra(NavExpenseActivity.str_startTime, startTime);
        intent.putExtra(NavExpenseActivity.str_endTime, endTime);
        intent.putExtra(NavExpenseActivity.str_title, title);
        intent.putExtra(NavExpenseActivity.str_mode, mode);

        startActivity(intent);
    }


// ==================== date function ===========================================//

    public static long getCurrentTime() {
        return Calendar.getInstance().getTimeInMillis();
    }

    public static long getFirstOfWeek(long time) {
        Date date1, date2;
        date1 = new Date(time);
        date2 = new Date(date1.getYear(), date1.getMonth(), date1.getDate() - (date1.getDay() + 6) % 7);
        return date2.getTime();
    }

    public static long getLastOfWeek(long time) {
        Date date1, date2;
        date1 = new Date(time);
        date2 = new Date(date1.getYear(), date1.getMonth(), date1.getDate() - (date1.getDay() + 6) % 7 + 6);
        return date2.getTime();
    }

    public static long getFirstOfMonth(long time) {
        Date date1, date2;
        date1 = new Date(time);
        date2 = new Date(date1.getYear(), date1.getMonth(), 1);
        return date2.getTime();
    }

    public static long getLastOfMonth(long time) {
        Date date1, date2;
        date1 = new Date(time);
        date2 = new Date(date1.getYear(), date1.getMonth() + 1, 0);
        return date2.getTime();
    }



    private void initDate(){
        year = String.valueOf(calendar.get(Calendar.YEAR));
        month = String.valueOf(calendar.get(Calendar.MONTH)+1);
        if(Integer.parseInt(month)&lt;10)
            month ="0" + month;
        day = String.valueOf(calendar.get(Calendar.DATE));
        if(Integer.parseInt(day)&lt;10)
            day ="0" + day;
        calendar.setFirstDayOfWeek(Calendar.MONDAY);
    }

    private void loadingFormation() {


        add_expense_quickly_btn = (Button) findViewById(R.id.add_expense_quickly_btn);
        add_expense_quickly_btn.setOnClickListener(this);

        month_tv = (TextView) findViewById(R.id.month_tv);

        income_amount_tv = (TextView) findViewById(R.id.income_amount_tv);
        expense_amount_tv = (TextView) findViewById(R.id.expense_amount_tv);
        budget_balance_amount_tv = (TextView) findViewById(R.id.budget_balance_amount_tv);

        date_of_month_tv = (TextView) findViewById(R.id.date_of_month_tv);
        today_datestr_tv = (TextView) findViewById(R.id.today_datestr_tv);
        today_expense_amount_tv = (TextView) findViewById(R.id.today_expense_amount_tv);
        today_income_amount_tv = (TextView) findViewById(R.id.today_income_amount_tv);
        week_datestr_tv = (TextView) findViewById(R.id.week_datestr_tv);
        week_expense_amount_tv = (TextView) findViewById(R.id.week_expense_amount_tv);
        week_income_amount_tv = (TextView) findViewById(R.id.week_income_amount_tv);
        month_datestr_tv = (TextView) findViewById(R.id.month_datestr_tv);
        month_expense_amount_tv = (TextView) findViewById(R.id.month_expense_amount_tv);
        month_income_amount_tv = (TextView) findViewById(R.id.month_income_amount_tv);


        findViewById(R.id.today_row_rl).setOnClickListener(this);
        findViewById(R.id.week_row_rl ).setOnClickListener(this);
        findViewById(R.id.month_row_rl).setOnClickListener(this);
        findViewById(R.id.nav_account_btn).setOnClickListener(this);
    }

    private void initInfo() {

        db = SplashScreenActivity.db;

        // text
//      calendar.set(2011, 0, 3);
//      db.insert("TBL_EXPENDITURE", new String[] {"AMOUNT","DATE"}, new String[] {"100",format(calendar.getTime())});
        month_tv.setText(month);

        Cursor cursor = db.rawQuery("select sum(AMOUNT) from TBL_INCOME",null);
        if (cursor.moveToNext()) {
            income_amount_tv.setText("RM " + cursor.getDouble(0));
            income_amount = (int) cursor.getDouble(0);
        }

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_EXPENDITURE",null);
        if (cursor.moveToNext()) {
            expense_amount = (int) cursor.getDouble(0);
            expense_amount_tv.setText("RM " + cursor.getDouble(0));
        }


        cursor = db.rawQuery("select sum(BUDGET) from TBL_EXPENDITURE_CATEGORY",null);
        if (cursor.moveToNext()) {
            budget_balance_amount_tv.setText("-RM " + cursor.getDouble(0));
        }

        date_of_month_tv.setText(day);
        today_datestr_tv.setText(year + "/" + month + "/" + day);

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_EXPENDITURE where strftime('%Y-%m-%d',DATE)=?", new String[]{format(calendar.getTime(),0)});
        if (cursor.moveToNext()) {
            today_expense_amount_tv.setText("-RM " + cursor.getDouble(0));
        }

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_INCOME where strftime('%Y-%m-%d',DATE)=?", new String[]{format(calendar.getTime(),0)});
        if (cursor.moveToNext()) {
            today_income_amount_tv.setText("RM " + cursor.getDouble(0));
        }


        cursor = db.rawQuery("select sum(AMOUNT) from TBL_EXPENDITURE where strftime('%Y-%m-%d',DATE)&gt;=? and strftime('%Y-%m-%d',DATE)&lt;=?", new String[]{getMondayOFWeek(),getCurrentWeekday()});
        if (cursor.moveToNext()) {
            week_expense_amount_tv.setText("-RM " + cursor.getDouble(0));
        }

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_INCOME where strftime('%Y-%m-%d',DATE)&gt;=? and strftime('%Y-%m-%d',DATE)&lt;=?", new String[]{getMondayOFWeek(),getCurrentWeekday()});
        if (cursor.moveToNext()) {
            week_income_amount_tv.setText("RM " + cursor.getDouble(0));
        }
        week_datestr_tv.setText(weekStart + "-" + weekEnd);


        month_datestr_tv.setText(month + "/01-" + month + "/" + getDefaultDay());

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_EXPENDITURE where strftime('%Y%m',DATE)=?", new String[]{year + month});
        if (cursor.moveToNext()) {
            month_expense_amount_tv.setText("- RM " + cursor.getDouble(0));
        }

        cursor = db.rawQuery("select sum(AMOUNT) from TBL_INCOME where strftime('%Y%m',DATE)=?", new String[]{year + month});
        if (cursor.moveToNext()) {
            month_income_amount_tv.setText("RM " + cursor.getDouble(0));
        }

        cursor.close();

//      myProcessBar.setProgress(expense_amount/income_amount);
    }


    private int getMondayPlus() {
        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)-1;
        if (dayOfWeek == 1) { 
            return 0; 
        } else { 
            return 1 - dayOfWeek; 
        } 
    } 

    public String getCurrentWeekday() { 
        int mondayPlus = this.getMondayPlus(); 
        GregorianCalendar currentDate = new GregorianCalendar(); 
        currentDate.add(GregorianCalendar.DATE, mondayPlus+6); 
        Date monday = currentDate.getTime(); 

        String preMonday = format(monday,0); 
        weekEnd = format(monday,DATE_MOTH_DAY);
        return preMonday; 
    } 

    public String getMondayOFWeek(){ 
        int mondayPlus = this.getMondayPlus(); 
        GregorianCalendar currentDate = new GregorianCalendar(); 
        currentDate.add(GregorianCalendar.DATE, mondayPlus); 
        Date monday = currentDate.getTime(); 

        String preMonday = format(monday,0); 
        weekStart = format(monday,DATE_MOTH_DAY);
        return preMonday; 
    } 


    public String getDefaultDay(){ 
        String str = ""; 
        Calendar lastDate = Calendar.getInstance(); 
        lastDate.set(Calendar.DATE,1);
        lastDate.add(Calendar.MONTH,1);
        lastDate.add(Calendar.DATE,-1);
        str=format(lastDate.getTime(),DATE_DAY); 
        return str; 
    }

    private String format(Date date,int id){
        String str = "";
        SimpleDateFormat ymd = null;
        switch (id) {
        case DATE_MOTH_DAY:
            ymd = new SimpleDateFormat("MM/dd");
            break;
        case DATE_DAY:
            ymd = new SimpleDateFormat("dd");
            break;
        default:
            ymd = new SimpleDateFormat("yyyy-MM-dd");
            break;
        }
        str = ymd.format(date); 
        return str;
    }

    public void onBackPressed() {
        new AlertDialog.Builder(this).setTitle(getString(R.string.point))
        .setMessage(getString(R.string.exit_message))
        .setPositiveButton(getString(R.string.exit_ok), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
                // TODO Auto-generated method stub
                db.close();
                finish();
                android.os.Process.killProcess(android.os.Process.myPid());
            }
        }).setNegativeButton(getString(R.string.exit_cancle), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            // TODO Auto-generated method stub

        }
        }).show();
    }
}
</code></pre>

<p>Here is the coding for splashscreen activity:</p>

<pre><code>import com.uangel.suishouji.db.MyDbHelper;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.database.Cursor;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;

/**
 * @author weijun
 * 
 */
public class SplashScreenActivity extends Activity {
    public static MyDbHelper db = null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen_activity);
        initialDBData();
        CommonData.getInstance().load(this);
    }
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // TODO Auto-generated method stub
        //activity jump
        Intent i=new Intent(SplashScreenActivity.this,MainActivity.class);
        startActivity(i);
        this.finish();
        return super.onTouchEvent(event);
    }

    private void initialDBData() {
        // create database
//      deleteDatabase("mydb");
        db = MyDbHelper.getInstance(this.getApplicationContext());
        Resources res = this.getResources();
        db.open();
        Cursor cursor = db.select("TBL_EXPENDITURE_CATEGORY", new String[] {
                "ID", "NAME", "BUDGET" }, null, null, null, null, null);
        if (cursor.moveToNext()) {
            cursor.close();
//          db.close();
            return;
        }
        // insert expense
        String[] arr = res.getStringArray(R.array.TBL_EXPENDITURE_CATEGORY);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_CATEGORY", new String[] { "NAME",
                    "BUDGET" }, new String[] { arr[i], "0" });

        }
        // insert sub category
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_1);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "1" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_2);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "2" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_3);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "3" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_4);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "4" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_5);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "5" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_6);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "6" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_7);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "7" });
        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_8);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "8" });
        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_9);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "9" });

        }

        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_10);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "10" });

        }
        arr = res.getStringArray(R.array.TBL_EXPENDITURE_SUB_CATEGORY_11);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i(" TEST", arr[i]);
            db.insert("TBL_EXPENDITURE_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "11" });

        }
        // insert income category
        arr = res.getStringArray(R.array.TBL_INCOME_CATEGORY);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_INCOME_CATEGORY", new String[] { "NAME" },
                    new String[] { arr[i] });

        }
        // insert income sub
        arr = res.getStringArray(R.array.TBL_INCOME_SUB_CATEGORY_1);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_INCOME_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "1" });
        }
        arr = res.getStringArray(R.array.TBL_INCOME_SUB_CATEGORY_2);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_INCOME_SUB_CATEGORY", new String[] { "NAME",
                    "PARENT_CATEGORY_ID" }, new String[] { arr[i], "2" });

        }

        // insert account
        arr = res.getStringArray(R.array.TBL_ACCOUNT_TYPE);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_TYPE", new String[] { "NAME", "POSTIVE" },
                    new String[] { arr[i].substring(0, arr[i].indexOf(",")),
                            arr[i].substring(arr[i].indexOf(",") + 1) });

        }
        // insert account sub
        arr = res.getStringArray(R.array.TBL_ACCOUNT_SUB_TYPE_1);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_SUB_TYPE", new String[] { "NAME",
                    "PARENT_TYPE_ID" }, new String[] { arr[i], "1" });

        }
        arr = res.getStringArray(R.array.TBL_ACCOUNT_SUB_TYPE_2);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_SUB_TYPE", new String[] { "NAME",
                    "PARENT_TYPE_ID" }, new String[] { arr[i], "2" });

        }
        arr = res.getStringArray(R.array.TBL_ACCOUNT_SUB_TYPE_3);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_SUB_TYPE", new String[] { "NAME",
                    "PARENT_TYPE_ID" }, new String[] { arr[i], "3" });

        }
        arr = res.getStringArray(R.array.TBL_ACCOUNT_SUB_TYPE_4);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_SUB_TYPE", new String[] { "NAME",
                    "PARENT_TYPE_ID" }, new String[] { arr[i], "4" });

        }
        arr = res.getStringArray(R.array.TBL_ACCOUNT_SUB_TYPE_5);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT_SUB_TYPE", new String[] { "NAME",
                    "PARENT_TYPE_ID" }, new String[] { arr[i], "5" });

        }
        // insert account
        arr = res.getStringArray(R.array.TBL_ACCOUNT);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ACCOUNT", new String[] { "NAME", "TYPE_ID",
                    "SUB_TYPE_ID", "ACCOUNT_BALANCE" }, arr[i].split(","));
        }
        // insert store
        arr = res.getStringArray(R.array.TBL_STORE);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_STORE", new String[] { "NAME" },
                    new String[] { arr[i] });
        }
        // insert item
        arr = res.getStringArray(R.array.TBL_ITEM);
        for (int i = 0; i &lt; arr.length; i++) {
            Log.i("TEST", arr[i]);
            db.insert("TBL_ITEM", new String[] { "NAME" },
                    new String[] { arr[i] });
        }
        /*
         * cursor =db.select("TBL_EXPENDITURE_CATEGORY", new
         * String[]{"ID","NAME","BUDGET"}, null, null, null, null, null);
         * while(cursor.moveToNext()) {
         * Log.i("TBL_EXPENDITURE_CATEGORY",cursor.getString
         * (0)+","+cursor.getString(1)); }
         */
//      db.close();

    }
}
</code></pre>

<p>That means what i need to correct?sorry, i am newbie for android developer.</p>
