Skip to main content


Showing posts from March, 2011

Using samsung android phone with windows xp

I have a Samsung galaxy 551. I tried connecting it to the pc. I am supposed to install the driver for it. The installation cd had keis on it. Anyway I tried installing it. It should one or two errors, but completed installing,
  When I ran this Keis, it is not showing my phone even though I have connected the phone using usb.  Nor am I seeing it in "my computers". I tried tethering usb from the phone. The windows usb wizard would say " New device found" and give installation instruction. But it will finally say installation failed as there is no driver  samsung android. I tried uninstalling and reinstalling keiss 2-3 times.
  Now I remembered one of the errors I got during installation of Keiss was "unable to find samsung usb driver for android.exe or something of that type. So I googled for that file and downloaded it from the site
and instal…

Tabs with different background colors

For past 3 days I was trying to have different colors for android tabs instead of normal grey and whitish grey. I got an articles from net android tabs like iphone. Now I am unable to find the article now. Anyways, here is the code
View view = new MyView(this, R.drawable.custombutton, R.drawable.custombutton, "Channels");
       //         channelTabSpec = tabhost.newTabSpec("channels").setIndicator(view)
        .setContent(intent);  tabhost.addTab(channelTabSpec); --- ---- ---
Similarly I created two more tabs Newspapers and Techsites. The class MyView used above is 
private class MyView extends LinearLayout {
          ImageView iv;
          TextView tv;
          public MyView(Context c, int drawable, int drawableselec, String label) {

           tv = new TextView(c);


How to access sqlite table from emulator

You can see the contents of text files by exporting it from emulator, but what about sqlite tables? You can use sqlite3 as explained below.
You need to access the adb shell first.
If you are using Linux system, it is simple enough. Just give the command

    adb shell
But for windows xp system, the path might not be properly set. If that is the case, go to the folder where android sdk is installed

If android sdk is installed in f:\android-sdk-windows, then go there and then goto subdirectory tools in that.
Now give the command

     adb shell
Next you need to go to directory which has your sqlite database. For that you use command
     cd /data/data      cd com.pkg.pkg1
Here com.pkg.pkg1 must be replaced by your packagename of android project.

     cd databases      dir
At this point, dir must show you the name of your database file. If your database name is mydb, then to open it using sqlite, give the command

    sqlite3 mydb
Now you can use any sql command like select, insert , update …

How to use a DatePickerDialog

You do not have a direct widget for date entry. You should use an edittext and enter the date in yyyy-mm-dd format. Instead you can use a datepicker dialog. This dialog can be displayed when user types on the editText which should store the date

If your edit text is etDialogDate,

etDialogDate.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                String dateText = ((TextView)v).getText().toString();
                int year,month,day;
                String temp[]=dateText.split("-");
                year = Integer.valueOf(temp[0]);
                month = Integer.valueOf(temp[1]);
                day= Integer.valueOf(temp[2]);
                DatePickerDialog dtpkrdlg = new                       DatePickerDialog(ExpenseList.this, 0,                        new  DateSetListener(), year, month-1, day);

Now this will show the datepicker dialog with initial value …