toyrest.blogg.se

Mongodb compass filter example
Mongodb compass filter example




When we run the above program in the android studio we will get the result as shown below. If you observe above AndroidManifest.xml file we added following extra fields of Intent filters.Īction - we use this property to define that the activity can perform SEND action.Ĭategory - we included the DEFAULT category for this activity to be able to receive implicit intents.ĭata - the type of data the activity can send. Now open android manifest file ( AndroidManifest.xml) and write the code like as shown below AndroidManifest.xml

  • EXTRA_SUBJECT – The subject of the email that we want to send.
  • EXTRA_EMAIL – It’s an array of email addresses.
  • PutExtra - we use this putExtra() method to add extra information to our Intent.

    mongodb compass filter example

    Here we used “ message/rfc822” and other MIME types are “ text/plain” and “ image/jpg” SetType - We use this property to set the MIME type of data that we want to send. If you observe above code we used multiple components to send email, those areĪCTION_SEND - It’s an activity action that specifies that we are sending some data. StartActivity(Intent.createChooser(si, "Choose Mail App" )) EXTRA_TEXT, "Hi Guest, Welcome to Tutlane Tutorial Site" ) Public class MainActivity extends AppCompatActivity void onCreate(Bundle savedInstanceState) ) In case if you are not aware of creating an app in android studio check this article Android Hello World App. Here we will configure and send an email using Intent Filters in the android application.Ĭreate a new android application using android studio and open an activity_main.xml file from \src\main\res\layout path. Android Intent Filters Exampleįollowing is the complete example of using Intent Filters in android applications. The user might enter this activity by navigating from MainActivity and they can also enter directly from another app using Implicit Intent which is matching one of the two activity filters. The second activity “ ResultActivity” is intended to help us to share the text. These two ( MAIN, LAUNCHER) elements must be paired together in order for the activity to appear in the app launcher. In case if the element doesn’t specify an icon with icon, then the system uses the icon from the element.

    mongodb compass filter example

    LAUNCHER - It indicates that this activity icon should be placed on the home screen list of apps.

    mongodb compass filter example

    MAIN - It indicates the app’s main entry point that means it starts the activity which defines with the MAIN action when the user initially launches the app with a launcher icon. If you observe above code snippet the activity “ MainActivity” will act as an entry point for our app because we defined an activity using MAIN action and LAUNCHER category attributes in intent filters (). Intent Filter in Manifest Fileįollowing is the code snippet of defining an activity with Intent Filter ( ) in the Android Manifest file ( AndroidManifest.xml) like as shown below. It defines the type of data to be accepted and by using one or more attributes we can specify various aspects of the data URI (scheme, host, port, path) and MIME type. It defines the name of an intent category to be accepted and it must be the literal string value of an action, not the class constant. It defines the name of an intended action to be accepted and it must be a literal string value of an action, not the class constant. Generally, the Intent Filters () whatever we define in the manifest file can be nested in the corresponding app components and we can specify the type of intents to accept using these three elements.

    mongodb compass filter example

    In case if we create Intent Filter for an activity, there is a possibility for other apps to start our activity by sending a certain type of intent otherwise the activity can be started only by an explicit intent. In android, Intent Filter is an expression in the app’s manifest file ( ActivityMainfest.xml) and it is used to specify the type of intents that the component would like to receive.






    Mongodb compass filter example