java - How to add IntentFilter in an Activity by code? -


i have activity holds 2 intent filters , problem not use activity devices 1.6 , before since wanted them use native contacts.

thanks!

public class extends activity {     public {         intentfilter filter = new intentfilter(your_broadcast);         filter.addaction(your_broadcast_2);         registerreceiver(mreceiver, filter);     }      private final broadcastreceiver mreceiver = new broadcastreceiver() {         @override         public void onreceive(context context, intent intent) {             // code here         }     }; } 

first declare filter - can add multiple actions single filter. need register broadcastreceiver serve upon arrival.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -