Code Monkey home page Code Monkey logo

intents-example's Introduction

intents-example

This example project shows how how to use intents for different actions. The example also gives the basic understanding about implicit and explicit intents.

Prerequisites

  • Java environment setup
  • Android Studio
  • Android SDK v24
  • Latest Android Build Tools

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development. This sample uses the Gradle build system.

  1. Download the samples by cloning this repository or downloading an archived snapshot. (See the options at the top of the page.)
  2. In Android Studio, create a new project and choose the "Import non-Android Studio project" or "Import Project" option.
  3. Select the intents-example directory that you downloaded with this repository.
  4. Wait for gradle to build and sync.
  5. Click on the 'Run' icon. Now select an AVD(Android Virtual Device). If it doesn't exist then create one targeting latest API's(atleast v24).
  6. Wait for emulator to start completely and run the application.

Guide

There are two types of intents:

  • Explicit intents specify the component to start by name (the fully-qualified class name). You'll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start. For example, you can start a new activity in response to a user action or start a service to download a file in the background.
  • Implicit intents do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it. For example, if you want to show the user a location on a map, you can use an implicit intent to request that another capable app show a specified location on a map.
    -- source: https://developer.android.com/guide/components/intents-filters.html

In short, explicit intents are user defined where we know our current component and our target component inside our own app. Generally they are used to open a new activity. But, in case of implicit intents we may several apps for a particular intent action therefore we create a 'chooser' to handle this situation. And thus, we get list of matching apps for our request.

intents-example's People

Contributors

niksbhardy avatar dutta249 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.