Sei sulla pagina 1di 4

Android Some Features: + Background Services + Access to Hardware: GPS, Camera,Bluetooth,Wi-Fi,accelerometer,touch-screen power management.

+ Native google maps, geocoding and location based services. + SQLite Database: for data storage and retrieval. By default each applications database is sandboxed.Its content is available only to the application that created it. Content-Provider supplies a mechanism to share this data. + Shared Data and Inter-application communication: 3 techniques for transmitting info from apps: 1.Notifications: Standard ways in which a mobile device traditionally alerts user. Trigger audible alert, vibration, flash the device LED, showing dialog boxes. 2. Intents: Intents provide a mechanism for message passing within and between applications. Using Intents, you can broadcast a desired action. (Like: dialing the phone or editing a contact details). 3.Content-Provider: It gives managed access to an applications private database. Native apps like contact manager act as content-providers. So, we can make applications to access the contacts. If we implement content provider in our application, we can allow other applications to access our application database. + Extensive media support & 2D/3D Graphics: Some of the supported formats: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF. Android Software Stack: + Linux Kernel : H/w drivers , power management, Memory Management, Process Management + [ Libraries ] : OpenGL , SQLite, Media, LibC, WebKit [ Android Run Time ] : Android Libraries , DVM + Application Frame Work : Location based services, content provider, Views , Notifications, Window Manager, Activity Manager, Resource Manager, Telephony. + Application Layer: Native Apps (Browser, Contacts, etc ...), Developer Apps, Third Party Apps. Android Application Architecture: + Activity Manager: It controls the life cycle of an activity. It also manages the activity stack. + Views: They are used to construct the UI for activities. All the layout, UI classes are derived from Views. + Notification Manager: Mechanism to signal users. [UP: Notifications] + Content Provider: [UP] + Resource Manager: Supports non-code resources like strings and graphics to be externalized. Basic APIs android.util , android.os , android.graphics , android.database, android.view , com.google.android.maps, android.text Advanced: android.location , android.media, android.opengl, android.hardware. Types of Android Applications: + Foreground Activity : An application that is useful only when it is in the foreground. Ex: games. + Background Service: An application that spends most of its lifetime hidden. Ex: SMS auto-responders. + Intermitted Activity: Expects some interactivity but does most of its work in background. Ex: media-player. Android Design Philosophy : 1. Fast 2. Responsive (5sec for key/touch , 10secs for broadcast reciever) 3. Secure 4. Seamless Android Building Blocks 1. Activities : Its the applications presentation layer. Every screen in an app will be an extension of Activity class. Activities use Views to form GUI that display information and respond to user actions. To display a UI , we assign a View or layout to an activity. 2. Services: They are the invisible workers of an application. Service components run invisibly, updating data sources and visible activities and triggering Notifications. They continue to work even when the activity is not active or visible. 3. Content Provider: [UP] 4. Intents: [UP] 5. BroadCast Recievers: By casting and registering a Broadcast receiver, an application can listen for Broadcast Intents that match a specific filter criteria. Broadcast receivers will automatically start an application to respond to an incoming Intent, making them ideal for event-driven applications.

6. Notifications: [UP] Android Activity Classes 1.MapActivity: Encapsulates the resource handling to support a MapView widget within an Activity. 2.ListActivity: Wrapper class for Activities that feature a ListView . 3.ExpandableListActivity: Similar to ListActivity but supporting to ExpandableListView. 4.ActivityGroup: Allows us to embed multiple Activities in a single screen. Dalvik Virtual Machine (DVM): Dalvik is the virtual machine which runs the Java platform on Android mobile devices. It runs applications which have been converted into a compact Dalvik Executable (.dex) format suitable for systems that are constrained in terms of memory and processor speed. Android Development Tools: + Emulator + DDMS : Dalvik Debug Monitoring Service: Its is used to monitor and control the DVMs on which we are debugging an application. + AAPT : Android Asset Packaging Tool: Builds the Android distributable package files (.apk). + ADB : Android Debug Bridge: It is a client-server application that provides a link to a running emulator. It lets you copy files, install .apk files and run shell commands. + SQLite3: A database tool that you can use to access the SQLite database files created and used by Android. + TraceView: Graphical Analysis tool for viewing the trace logs from an Android application. + MkSDCard: Creates an SD Card disk image that can be used by the emulator to simulate external storage card. + dx : It converts java .class bytecode into Android .dex bytecode. + ActivityCreator: Script that generates Ant build files that you can use to compile Android application without ADT. Intent Filter: It declares the capabilities of its parent component what an activity or service can do and what types of broadcasts a receiver can handle. Most of the contents of a filter are described by its <action>, <category> and <data> sub-elements. Binder: It is the base class for remote object, The core part of light weight RPC mechanism defined by IBinder. Implements IBinder. TOAST: Toast.makeText(this, Hello, Toast.LENGTH_SHORT).show(); View: A view is a widget that has an appearance on the screen. Examples of widgets are buttons,labels,textboxes etc. View derives from the vase class android.view.View ViewGroup: one or more views can be grouped together into a ViewGroup. A ViewGroup derives from the base class android.view.ViewGroup. Different ViewGroups: 1.LinearLayout 2.AbsoluteLayout 3.TableLayout 4. RelativeLayout 5. FrameLayout 6. ScrollView LinearLayout: It arranges views in a single coloumn/single row. Child views can be arranged vertically/horizontally. AbsoluteLayout: Here we specify the exact location of its children. android:layout_x=120px android:layout_y=150px TableLayout: It groups views into rows and columns.We can use<TableRow>element to designate a row in a table. RelativeLayout: It specifies how child views are positioned relative to each other. layout_alignLeft, layout_alignRight, layout_below, layout_alignParentTop, layout_alignParentLeft, layout_centerHorizontal FrameLayout: It is a placeholder on screen that you can use to display a single view. Views that you add to a FrameLayout is always anchored to the top left of the layout. ScrollView: It is a special type of FrameLayout in that it allows users to scroll through a list of views that occupy more space than the physical display. The ScrollView can contain only one child view or ViewGroup, which normally is a LinearLayout. startActivity(new Intent(Intent.ACTION_VIEW), Uri.parse(web)); startActivity(new Intent(Intent.ACTION_CALL), Uri.parse(tel: 87654));

Menus: public boolean onCreateOptionsMenu(Menu menu) { menu.add(groupid, menuitemid, menuitemId, menuItemorder , menuItemText); } public boolean onOptionsItemSelected(MenuItem item) { switch(item.getIntentId()) { . } } Cursor: Cursor alldetails= dbb.getAllDetails(); int nameIndex = alldetails.getColoumnIndex(Name); if(alldetails.moveToFirst()){ do{ S.O.P(+alldetails.getString(nameIndex)); }while(alldetails.moveToNext()); } ArrayAdapter ArrayAdapter<String> notes = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, _namesList); setListAdapter(notes); public void onListItemClick(ListView parent, View v, int position , long id) { } ContentProvider //Must override public String getType(Uri _uri) public int delete(Uri _uri, String arg1, String[] arg2) public Uri insert(Uri _uri, ContentValues _cv) public boolean onCreate() public Cursor query(Uri uri, String[] arg1, String arg2, String [] arg3, String arg4) public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) ContentUser getContentResolver().delete(content///40, null, null); SQLITE: public class DBHelper extends SQLiteOpenHelper { public void onCreate(SQLiteDatabase db){ db.execSQL(query) } public void onUpgrade(SQLiteDatabase db, int oldversion, int newversion){ db.execSQL(DROP TABLE IF EXISTS tablename); onCreate(db); } } _dbhelper = new DBHelper(context ,databasename,null,dbVersion); SQLiteDatabase db; try{ db = _dbhelper.getWritableDatabase() }catch(SQLiteException ex){ db = _dbhelper.getWritableDatabase() } ContentValues cv = new ContentValues(); cv.put(NAME,abhi); db.insert(tablename,null,cv); // returns -1 if failed db.update(tablename, cv, where , null); db.delete(tablename, where , null); db.query(tablename,null,null,null,null,null,null); INTENTS startActivityForResult(intent, 1);

public void onActivityResult(int requestCode , int resultCode, Intent data){ } -Intent result = getIntent(); result.putExtra(NAME,XYZ); setResult(RESULT_OK, result); finish(); BROADCAST: Intent _in = new Intent(BC_ACTION_STR); sendBroadCast(_in); -public void onRecieve(Context _cxt, Intent _intent){ } NOTIFICATION MANAGER: It is a system service used to handle notifications. Get reference to it using getSystemService method. String svcName = Content.NOTIFICATION_SERVICE; NotificationManager _nm; _nm = (NotificationManager)getSystemService(svcName); Notification _nf = new Notification(icon,tickertext,when); PendingIntent launchIntent = PendingIntent.getActivity(this,0, new Intent(this,MainActivity.class),0); _nf.setLatestEventInfo(context, expandTitle , expandText, launchIntent); _nm.notify(notificationRefID, _nf);

Potrebbero piacerti anche