Android Programming Notes

Basic Application elements

  •    Views  – TextBox etc ,
  •    GroupViews – LinerLayout etc
  •    Activity   – Main Screen and other screens
  •   Intent  – Communication mechanism between Activities

Android Activity Life Cycle ( Names are kind of self explanatory ! )

  •  OnCreate
  •  OnStart
  • OnResume
  • OnPause
  • OnPause
  • OnStop
  • OnDestroy

findViewById(R.id.response)  :- find the view by id in xml file , Cast it to appropriate class

Toast for displaying small messages

startActivity(intent) to create an new intent

Layouts

  • Relative
  • Absolute
  • Lenier
  • Table
  • Grid

Log.* for logging  (DDMS)

Its is actually very easy , Most of it it there in SDK documentation.   I will read the SDK doc to get stuff done for the most part .  Bye for now . This is not supposed to make sense for anyone other than myself gg 😀

Advertisements

Android device not regonized ?

Borrowed from Stackoverflow . Keeping it here for my ready reference

http://stackoverflow.com/questions/7594975/why-is-eclipse-and-adb-not-recognizing-my-android-device

First, check the kind of quotes you are using in your udev rules. It looks like you might be using non-ASCII double quotes. See the difference between the quotes around usb and usb_device, etc.

UBSYSTEM=="usb", SYSFS{idVendor}=="1bbb", MODE="0666"
SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”1bbb”, MODE="0666"

You can also just use sudo with ADB, as suggested by @JeremyD. Doing that makes this file essentially irrelevant.

Second,

  1. Edit ~/.android/adb_usb.ini (or if you are running as root, check /root/.android)
  2. Add 0x1bbb to the end of the file if it already exists, otherwise do: echo 0x1bbb >> adb_usb.ini
  3. adb kill-server
  4. adb start-server
  5. Check output of adb devices for your device

Embedded Linux Development

Although having no real world experience in embedded Linux development, I was deeply interested about the subject. I therefore read many books on the subject and the sad part is there is nothing that cannot be found online. I basically wasted money on the book, I therefore present summary of what I read and plenty of web references so that you save money on those books !.

Step 1 – Learning how to develop a Linux distro by hand

There are plenty of projects that help you do this , only difference is that them most books make use of uclibc or newlib instead of the standard glibc . These are the set of resources that will help you get started on rolling a base linux  system from scratch. Also vim is one true editor, learn to use vim – use vim as the IDE ,period.

  1.  http://www.linuxfromscratch.org/
  2.  http://www.tldp.org/LDP/Pocket-Linux-Guide/html/
  3.  http://www.linuxfromscratch.org/hints/downloads/files/uclibc-bootfloppy.txt
  4.  http://freshmeat.net/projects/natld/
  5. http://www.xs4all.nl/~lennartb/installdisk/index.html
  6. http://modest-proposals.com/Hacklin.htm
  7. http://buildroot.uclibc.org/  – Buildroot website

The modulus of operandi is as follows

  • Build a root file system structure with what you need
  • Compile the  kernel with barely enough features needed
  • Installing the boot loader , In previous linux versions pre 2.6 i guess , you may get away without installing a boot loader . A summary linux bootloaders is given in following pages
  1. https://en.wikipedia.org/wiki/Comparison_of_boot_loaders
  2. http://lennartb.home.xs4all.nl/bootloaders/
  3. Network booting Linux :- http://www.sanitarium.net/golug/netboot.html
  4. http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch07_:_The_Linux_Boot_Process#.UbgNE_mRAkU
  • Setting various configurations files like initab, fstab etc

NOTE: if you are completely new to linux environment , you should check out the guide and tutorials in tldp.org  ( The Linux Documentation Project ) 

Step 2 – Learn and play around with POSIX API

Linux is after all a POSIX complaint system there are plenty of resources available to learn  POSIX programming .

  1. http://tldp.org/LDP/lpg/index.html – Linux Programming Guide
  2. http://www.advancedlinuxprogramming.com/downloads.html  – Advanced Linux Programming , available for download

Step 3- Learn various Linux File systems

Conventional ones include ext based on ones and those with journaling support  brtfs , jfs ,xfs , ReisesFS . Linux supports something known as VFS – or virtual files system which provides a generic interface that is used across files systems . The concept is very similar to inheritance concept in C++ , although Linux kernel is written in C , VFS is a good example that shows that modularity can be attained even if the underlying language does not support it .

Linux includes support for various embedded file systems like f2fs , – file system optimized for nand flash , read only squashfs file system  , tmpfs for storing stuff in ram.  The  mtd devices are found in /proc/mtd  . Typical embedded file systems include jffs2  , yaffs2 , ubifs ,

Step4 Learn about device drivers and about the linux kernel

Programming device drivers : http://lwn.net/Kernel/LDD3/ .   The best book on linux kernel in my opinion is by Bovet and Cesati. http://www.amazon.com/Understanding-Linux-Kernel-Third-Edition/dp/0596005652 . It is very well worth your money . But never hesitate to play around and tinker with stuff ! .  After this you have probably gained mastery over all aspects !.  I am listing few libraries that came to my head  . The list is no where near complete.

Light Weight Libraries/Tools to look at

C Libraries:

  • uclibc :- http://uclibc.org ( also look at busybox !)
  • eglibc:- eglibc.org
  • dietlibc
  • klibc
  • pdpc – public domain c library

Networking:

  • dropbear  -ssh
  • webservers :- lighthttpd  , boa , thttpd
  • avahi , bind , iw tools

For Graphics :

  • SDL – libSDL.org
  • DirectFb – directfb.org
  • Kdrive
  • MicroWindows / NanoX – microwindows.org
  • http://www.exploits.org/v4l/  – Video for linux
  • TinyGL by fabrice bellard

Databases:

  • sql lite

 

I summarize my bookish knowledge on embedded linux in general , if someone thinks more can be added , drop in a comment. I am almost sure no even a single soul reads my blog but i am hoping that some random soul will comment and suggest some improvemnts !