Become a superhero with your Samsung Android Behold II!!
Sunday, May 9, 2010
Wednesday, May 5, 2010
Creating Interfaces in XML
To save time and trouble, use the droiddraw.org online program or download it. It is an open source program. With it you can drag and drop widgets.
The code generated:
The code generated:
<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:id="@+id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <Button android:id="@+id/widget28" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffccffcc" android:text="Press Me" android:textStyle="bold|italic" android:layout_x="0px" android:layout_y="126px" > </Button> <TextView android:id="@+id/widget30" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ff000000" android:text="My First View" android:layout_x="112px" android:layout_y="95px" > </TextView> </AbsoluteLayout>
HOTT MD700 Tablet
- 7'' TFT, 800*480 pixel hi-definition Touch screen
- HDMI(1080P) Output
- WIFI, USB(OTG), SD card slot
- E-book function
- WIN CE SYSTEM (future Android!!)
- Video format:AVI,RM/RMVB,FLV,DAT,VOB,
WMV, MPG, MPEG-1, MPEG-11, MP4, MKV - Audio format: MP3, WMA, AAC, FLAC, WAV, OGG, APE
- Image Format: BMP,JPEG,PNG,GIF
Source: HOTT
Contact:
Shenzhen,China Factory
HONGFUTAI E-TECH(SHENZHEN) CO., LIMITED
ADD: Block6,Zone3,XinXing Industrial Park, XinHe Village,FuHai Avenue,FuYong Town, BaoAn District, ShenZhen ,China.
Postal Code:518103
TEL: +86-755-83123812 EXT:8088; 8802
FAX: +86-755-8312489
Great Wall GPad and GBook
Great Wall (Beijing) announced the released of the 7in GPAD and 10in GBOOK on 28 April 2010. However despite its name, it actually runs Windows CE!!
GPAD Specs (top left):
- CPU: Telechips 8901 720MHZ ARM 11
- 256MB DDR2 RAM
- 4Gb flash, expandable
- 1-32 Micro SD slot, 1400 mA Li-polymer battery, 1080 HDMI interface, GPS, Wifi, external 3G module
GBOOK specs (bottom left):
- CPU Core 2 Duo U230,CS35 Chipset
- 2G DDR RAM
- Intel GMA45000MHD integrated graphics
- 2.5 HDD
- 10/100M LAN, Wifi, Bluetooth
Source: shanzhaiben.com
Content Providers and SQLite
The content provider abstraction allows you to retrieve data using REST-like syntax. For example, to retrieve book 69 from the book database, create a URI like:
content://com.android.book.BookProvider/books/23
Content-provider abstraction is required only if you want to share data (files, SQL data, etc) externally or between applications.
SQLite is built into the Android runtime, so Android applications can use SQLite databases.
If you are using the SQLite database only internally, you need a class that extends SQLiteOpenHelper, then create an instance and ask it to getReadableDatabase() or getWriteableDatabase().
db=(new myDBClass(this)).getWritableDatabase();
Use db.execSQL(...) to execute SQL statements such as insert, update and delete that does not return values, or db.insert(), db.delete(), db.update() can be used. The syntax is not JDBC but uses a simpler API.
Use db.rawQuery(..) if the select query is fixed, otherwise db.query(..), which returns a cursor. Another way is to use SQLiteQueryBuilder interface to encapsulate the call details.
content://com.android.book.BookProvider/books/23
Content-provider abstraction is required only if you want to share data (files, SQL data, etc) externally or between applications.
SQLite is built into the Android runtime, so Android applications can use SQLite databases.
If you are using the SQLite database only internally, you need a class that extends SQLiteOpenHelper, then create an instance and ask it to getReadableDatabase() or getWriteableDatabase().
db=(new myDBClass(this)).getWritableDatabase();
Use db.execSQL(...) to execute SQL statements such as insert, update and delete that does not return values, or db.insert(), db.delete(), db.update() can be used. The syntax is not JDBC but uses a simpler API.
Use db.rawQuery(..) if the select query is fixed, otherwise db.query(..), which returns a cursor. Another way is to use SQLiteQueryBuilder interface to encapsulate the call details.
Manually accessing SQLite databases on Android
Start the Android emulator or connect a device.
To see available devices, run: tools\android list avd
If emulator not started, using the name fround above, run: tools\emulator [avdname]
To see if devices connected run: tools/adb.exe devices
Open the adb shell: tools\adb.exe shell
Once the shell is started you have access to a Linux ash shell, with a limited commands. At the shell type, to show the list of files: ls -l
The of databases are in /data/data directory, execute: ls -R /data/data/*/databases
SQLite can be invoked: sqlite3 [database_name]
To quit SQLite, type: .exit
To copy the database to desktop PC, use : adb pull [database_name] [local path name]
Use adb push [local] [remote] to copy back the file
To see available devices, run: tools\android list avd
If emulator not started, using the name fround above, run: tools\emulator [avdname]
To see if devices connected run: tools/adb.exe devices
Open the adb shell: tools\adb.exe shell
Once the shell is started you have access to a Linux ash shell, with a limited commands. At the shell type, to show the list of files: ls -l
The of databases are in /data/data directory, execute: ls -R /data/data/*/databases
SQLite can be invoked: sqlite3 [database_name]
To quit SQLite, type: .exit
To copy the database to desktop PC, use : adb pull [database_name] [local path name]
Use adb push [local] [remote] to copy back the file
Tuesday, May 4, 2010
More on Android resources ...
Instead of specifying actual values as a resource (e.g. string, colour, etc), it can be referred by an indirection reference string. This is useful, e.g in internationalization, etc.
The format for specifying references resources in the XML file is:
@[package:]type/name
@[package:]+type/name
?[namespace:]type/name
If you are using the Android default package then [package:] can be omitted.
The '@' is for specifying references to the resource, i.e. get the actual value by looking it up as specified by the type and name,e.g.:
android:textColor="@color/opaque_red"
The actual value for opaque_red would have been specified in res/values/colors.xml.
The "+" is for auto-generation of resource value for the resource, generally used for generation the resource identification number, much like SQL auto-increment.
Without the "+" the resource value must have been specified beforehand, i.e in res/values/colors.xml
The "?" allows lookup using the name of the attribute of the resource, e.g.:
android:textColor="?android:textDisabledColor"
The format for specifying references resources in the XML file is:
@[package:]type/name
@[package:]+type/name
?[namespace:]type/name
If you are using the Android default package then [package:] can be omitted.
The '@' is for specifying references to the resource, i.e. get the actual value by looking it up as specified by the type and name,e.g.:
android:textColor="@color/opaque_red"
The actual value for opaque_red would have been specified in res/values/colors.xml.
The "+" is for auto-generation of resource value for the resource, generally used for generation the resource identification number, much like SQL auto-increment.
Without the "+" the resource value must have been specified beforehand, i.e in res/values/colors.xml
The "?" allows lookup using the name of the attribute of the resource, e.g.:
android:textColor="?android:textDisabledColor"
Monday, May 3, 2010
XML layout and R class
The user interface elements are declared in an XML file, these are compiled automatically (if you have setup your IDE correctly) into a R (for resource, i guess) class. Through R your Android program can access them.
So if your widgets and containers are specified in myMain.xml, then in your OnCreate() method of the Activity, then you use setContentView(R.layout.myMain).
If you want to access the elements in the XMl file, the element must have an android:id tag filled. To access the identified widget use findViewById by passing the numeric id found in the R.id.something.
XML fragment:
The fragment above declares a button with text "Press" for the specified size. To access the button, in this case, use findViewById(R.id.button1).
Eg.
Button btn=(Button) findViewById(R.id.button1);
btn.setOnClickListener(this);
...
...
So if your widgets and containers are specified in myMain.xml, then in your OnCreate() method of the Activity, then you use setContentView(R.layout.myMain).
If you want to access the elements in the XMl file, the element must have an android:id tag filled. To access the identified widget use findViewById by passing the numeric id found in the R.id.something.
XML fragment:
<ButtonFor the above to work the root element of the XML must declare the Android namespace.
android:id="@+id/button1"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:text="Press"
/>
The fragment above declares a button with text "Press" for the specified size. To access the button, in this case, use findViewById(R.id.button1).
Eg.
Button btn=(Button) findViewById(R.id.button1);
btn.setOnClickListener(this);
...
...
Android : Basic Classes and Concepts
View: Views are user interface elements, i.e. buttons, lists, etc. In Android user interface is specified declaratively in XML.
Activity: Activities encapsulate user interaction with various View elements, in this case a presentation screen, but view-less Activity is possible. Activities can be started by Intent, one Activity can start another Activity. The main program is an Activity.
ContentProvider: Abstracts data as service so that content can be shared and accessed in REST-based manner using URI locators, rather like http requests. This allows uniform means of accessing data without knowledge of structure and implementation. Android provides Sqlite for database access.
Intent: Intent can be thought of as a message broadcast, service or activity request; an "intention" for some action. Intent allows loose coupling of action requestor and action handler.
Service: background process.
Activity: Activities encapsulate user interaction with various View elements, in this case a presentation screen, but view-less Activity is possible. Activities can be started by Intent, one Activity can start another Activity. The main program is an Activity.
ContentProvider: Abstracts data as service so that content can be shared and accessed in REST-based manner using URI locators, rather like http requests. This allows uniform means of accessing data without knowledge of structure and implementation. Android provides Sqlite for database access.
Intent: Intent can be thought of as a message broadcast, service or activity request; an "intention" for some action. Intent allows loose coupling of action requestor and action handler.
Service: background process.
More .. Android Pads/Tablet
Source: chinitech
Subscribe to:
Posts (Atom)