Cursors
Cursors
Cursors contain the result set of a query made against a database in Android. Once a cursor has
been returned from a database query, an app needs to iterate over the result set and read the column
data from the cursor. Internally, the cursor stores the rows of data returned by the query along with
a position that points to the current row of data in the result set. When a cursor is returned from
a query() method, its position points to the spot before the first row of data.
Cursor
c=sqLiteDatabase.query(Tablename,Tablecolumn,whereclause,whereArgs,groupBy,having,order
By)
Return c
The Cursor class provides the following methods to manipulate its internal position:
• boolean Cursor.move(int offset): Moves the position by the given offset
• boolean Cursor.moveToFirst(): Moves the position to the first row
• boolean Cursor.moveToLast(): Moves the position to the last row
• boolean Cursor.moveToNext(): Moves the cursor to the next row relative to the current
position
• boolean Cursor.moveToPosition(int position): Moves the cursor to the specified position
• Cursor.moveToPrevious(): Moves the cursor to the previous row relative to the current
position
Intent
Android Intent: Intent is giving facilities to communicate between Android components in
several ways. Android Intent is mostly using for launching new Activity from Activity
Types of Intents
In Android, there are two types of Intents:
1. Explicit Intents
2. Implicit Intents
Explicit Intents
This intent specifies the component in an app. It is one that we use to launch a specific app component,
such as a particular activity or service in our application. Using this intent we can pass the data from one
activity to another activity.
Implicit Intents
Implicit intents do not name a specific component to perform a particular action, but instead it
declares a general action to be performed, which allows any component, even from another app
to handle it. It does not have exact knowledge about the landing component. It can open another
app or its own app’s component and many other options exist.
Examples: Downloaded song, PDF, image, document, dial call, map location, etc.
The constructor of the Implicit Intent's object needs a type of action you want to perform.
An action is a string that specifies the generic action to be performed.
Example
ACTION_VIEW: This action is used when you have some information that an activity can
show to the user, such as a photo to view in a Gallery app
ACTION_SEND: This action is used when you have some data that the user can share through
another app, such as an Email app or some Social Networking app.
Example