1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > android+notepad教程 Android Sample学习——NotePad

android+notepad教程 Android Sample学习——NotePad

时间:2023-11-27 08:53:33

相关推荐

android+notepad教程 Android Sample学习——NotePad

android.view.Menu专场

Interface for managing the items in a menu.

By default, every Activity supports an options menu of actions or options. You can add items to this menu and handle clicks on your additions. The easiest way of adding menu items is inflating an XML file into the

Different menu types support different features:

Context menus: Do not support item shortcuts and item icons.

Options menus: The icon menus do not support item check marks and only show the item's expanded menus (only available if six or more menu items are visible, reached via the 'More' item in the icon menu) do not show item icons, and item check marks are discouraged.

Sub menus: Do not support item icons, or nested sub menus.

public abstract MenuItemadd (int groupId, int itemId, int order, int titleRes)

Variation on

Parameters

groupId

The group identifier that this item should be part of. This can also be used to define groups of items for batch state changes. Normally use

itemId

Unique item ID. Use

order

The order for the item. Use

titleRes

Resource identifier of title string.

Returns

The newly added menu item.

public abstract MenuItemsetShortcut (char numericChar, char alphaChar)

Change both the numeric and alphabetic shortcut associated with this item. Note that the shortcut will be triggered when the key that generates the given character is pressed alone or along with with the alt key. Also note that case is not significant and that alphabetic shortcut characters will be displayed in lower case.

See

Parameters

numericChar

The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard.

alphaChar

The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

android.graphics.Rect

Rect holds four integer coordinates for a rectangle. The rectangle is represented by the coordinates of its 4 edges (left, top, right bottom). These fields can be accessed directly. Use width() and height() to retrieve the rectangle's width and height. Note: most methods do not check to see that the coordinates are sorted correctly (i.e. left <= right and top <= bottom).

android.graphics.Paint

The Paint class holds the style and color information about how to draw geometries, text and bitmaps.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

android.content.Intent专题:

Uri android.content.Intent.getData()

public UrigetData ()

Retrieve data this intent is operating on. This URI specifies the name of the data; often it uses the content: scheme, specifying data in a content provider. Other schemes may be handled by specific activities, such as http: by the web browser.

Returns

The URI of the data this intent is targeting or null.

public IntentsetData (Uri data)

Set the data this intent is operating on. This method automatically clears any type that was previously set by

Note: scheme and host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with these elements using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme and host is lower case.

Parameters

data

The URI of the data this intent is now targeting.

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

public static final StringACTION_INSERT

Activity Action: Insert an empty item into the given container.

Input:

Output: URI of the new data that was created.

Constant Value:"android.intent.action.INSERT"

public IntentsetAction (String action)

Set the general action to be performed.

Parameters

action

An action name, such as ACTION_VIEW. Application-specific actions should be prefixed with the vendor's package name.

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~·

android.app.Activity专场:

void android.app.Activity.finish()

public voidfinish ()

Call this when your activity is done and should be closed. The ActivityResult is propagated back to whoever launched you via onActivityResult().

public final voidsetResult (int resultCode, Intent data)

Call this to set the result that your activity will return to its caller.

Parameters

resultCode

The result code to propagate back to the originating activity, often RESULT_CANCELED or RESULT_OK

data

The data to propagate back to the originating activity.

public voidsetContentView (int layoutResID)

Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.

Parameters

layoutResID

Resource ID to be inflated.

public final CursormanagedQuery (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

Wrapper around

Parameters

uri

The URI of the content provider to query.

projection

List of columns to return.

selection

SQL WHERE clause.

selectionArgs

The arguments to selection, if any ?s are pesent

sortOrder

SQL ORDER BY clause.

Returns

The Cursor that was returned by query().

public voidsetTitle

Change the title associated with this activity. If this is a top-level activity, the title for its window will change. If it is an embedded activity, the parent can do whatever it wants with it.

public booleanonOptionsItemSelected

This hook is called whenever an item in your options menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities.

Derived classes should call through to the base class for it to perform the default menu handling.

Parameters

item

The menu item that was selected.

Returns

boolean Return false to allow normal menu processing to proceed, true to consume it here.

public IntentgetIntent ()

Return the intent that started this activity.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~·

android.widget.TextView专场:

public final voidsetTextKeepState

Like

Parameters

text

The new text to place in the text view.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

android.database.Cursor专场:

String android.database.Cursor.getString(int columnIndex)

public abstract StringgetString (int columnIndex)

Returns the value of the requested column as a String.

If the native content of that column is not text the result will be the result of passing the column value to String.valueOf(x).

Parameters

columnIndex

the zero-based index of the target column.

Returns

the value of that column as a String.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

android.content.ContentValues专题:

void android.content.ContentValues.put(String key, String value)

public voidput

Adds a value to the set.

Parameters

key

the name of the value to put

value

the data for the value to put

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。