Header Ads

  • Breaking News

    Intent in Android

    An Android 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, ServiceConnection, int) to communicate with a background Service.

    Types of Intents

    There are following two types of intents supported by Android

    Explicit Intents

    Explicit intent going to be connected internal world of application,suppose if you wants to connect one activity to another activity, we can do this quote by explicit intent, below image is connecting first activity to second activity by clicking button.
    Explicit Intents
    These intents designate the target component by its name and they are typically used for application-internal messages - such as an activity starting a subordinate service or launching a sister activity. For example −
    // Explicit Intent by specifying its class name
    Intent i = new Intent(FirstActivity.this, SecondActivity.class);
    // Starts TargetActivity

    Implicit Intents

    These intents do not name a target and the field for the component name is left blank. Implicit intents are often used to activate components in other applications. For example −
    Intent read1=new Intent();

    No comments

    Post Top Ad


    Post Bottom Ad