Giter Club home page Giter Club logo

intentdemo's Introduction

IntentDemo

Demo Description : Intent object's three aspects test : Action,Category&Data.

Abstract : Intents and Intent Filters

The official class overview An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity , broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, Ser- -viceConnection, int) to communicate with a background Service. An Intent called, to say, messages through which three of the core components of an application — activities, services, and b roadcast receivers — are activated.

Intent Structure

The primary pieces of information in an intent are: action -- The general action to be performed, such as ACTION_VIEW, ACTION_EDIT, ACTION_MAIN, etc. data -- The data to operate on, such as a person record in the contacts database, expressed as a Uri.

In addition to these primary attributes, there are a number of secondary attributes that you can also include with an intent: category -- For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application; CATEGORY_HOME means the home activity, that is the first activity that is displayed when the device boots. component -- Specifies an explicit name of a component class to use for the intent. type -- Specifies an explicit type (a MIME type) of the intent data. extra -- A Bundle of Key-value pairs for any additional information. flags -- Activity launch-mode.

Intent Resolution(解析)

Intents can be divided into two groups: :Explicit intents designate the target component by its name (the component name field, mentioned earlier, has a value set). Since component names would generally not be known to developers of other applications, explicit intents are typically used for applica- -tion-internal messages — such as an activity starting a subordinate service or launching a sister activity. :Implicit intents do not name a target (the field for the component name is blank). Implicit intents are often used to activate c- -omponents in other applications. :Only three aspects of an Intent object are consulted when the object is tested against an intent filter: action data (both URI and data type) category The extras and flags play no part in resolving which component receives an intent.

At final, this demo is main to test intent usages & unusages. This parts include three parts of Action-Test,Category-Test,Data-Test. Action test ———————— An element in the manifest file lists actions as subelements. For example: <intent-filter . . . > . . . Category test———————— An element also lists categories as subelements. For example: <intent-filter . . . > . . . Data test ———————— Like the action and categories, the data specification for an intent filter is contained in a subelement. And, as in those cases, the subelement can appear multiple times, or not at all. For example: <intent-filter . . . > <data android:mimeType="video/mpeg" android:scheme="http" . . . /> <data android:mimeType="audio/mpeg" android:scheme="http" . . . /> . . . Each element can specify a URI and a data type (MIME media type). There are separate attributes — scheme, host, port, and path — for each part of the URI: scheme://host:port/path For example, in the following URI, content://com.example.project:200/folder/subfolder/etc。

It's over!

intentdemo's People

Contributors

shendawei avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.