Android Intent Filter Example PDF

Summary

This document provides a program to demonstrate Intent Filter in Android programming. It showcases the usage of components like activities, intents, and how to filter intents to achieve specific tasks, such as picking contacts from a contacts list.

Full Transcript

Aim :-. Program to demonstrate Intent Filter activity_main.xml MainActivity.java package com.example.intentfilterexample; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.ContactsContract; import android.view.View; import android.vi...

Aim :-. Program to demonstrate Intent Filter activity_main.xml MainActivity.java package com.example.intentfilterexample; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.ContactsContract; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity extends Activity { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.btnIntent); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent (Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent,1); } }); } } Mainifest.xml Output –

Use Quizgecko on...
Browser
Browser