Example usage for android.content IntentFilter setPriority

List of usage examples for android.content IntentFilter setPriority

Introduction

In this page you can find the example usage for android.content IntentFilter setPriority.

Prototype

public final void setPriority(int priority) 

Source Link

Document

Modify priority of this filter.

Usage

From source file:im.afterclass.android.fragment.CommunicationFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    //mSearchText = new TextView(this);
    //setContentView(mSearchText);
    //getActivity().setTheme(android.R.style.Theme_WithActionBar);
    //setContentView(R.layout.activity_main);

    main = getActivity();/*from  ww  w.  j a v  a2  s  .c o  m*/

    chatHistoryFragment = new ChatHistoryFragment();
    contactListFragment = new ContactlistFragment();
    fragments = new Fragment[] { chatHistoryFragment, contactListFragment };

    initView();

    inviteMessgeDao = new InviteMessgeDao(getActivity());
    userDao = new UserDao(getActivity());
    // fragment
    /*getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment)
    .add(R.id.fragment_container, contactListFragment).hide(contactListFragment).show(chatHistoryFragment).commit();*/

    // ?BroadcastReceiver
    msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    getActivity().registerReceiver(msgReceiver, intentFilter);

    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    getActivity().registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    // setContactListener???
    EMContactManager.getInstance().setContactListener(new MyContactListener());
    // ??listener
    EMChatManager.getInstance().addConnectionListener(new MyConnectionListener());
    // ?listener
    EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();
}

From source file:com.aidigame.hisun.imengstar.huanxin.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    initView();/*from w w w  .  ja  v a2  s .c  o m*/

    if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow)
        showConflictDialog();

    inviteMessgeDao = new InviteMessgeDao(this);
    userDao = new UserDao(this);
    // fragment???
    // chatHistoryFragment = new ChatHistoryFragment();
    // ?fragment
    chatHistoryFragment = new ChatAllHistoryFragment();
    settingFragment = new SettingsFragment();
    fragments = new Fragment[] { chatHistoryFragment, settingFragment };
    // fragment
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment)
            .show(chatHistoryFragment).commit();

    // ?BroadcastReceiver
    msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    registerReceiver(msgReceiver, intentFilter);

    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    //??BroadcastReceiver
    IntentFilter cmdMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getCmdMessageBroadcastAction());
    cmdMessageIntentFilter.setPriority(3);
    registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter);

    // ?BroadcastReceiver
    /* IntentFilter offlineMessageIntentFilter = new
     IntentFilter(EMChatManager.getInstance()
     .getOfflineMessageBroadcastAction());
     registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter);*/

    // setContactListener???
    //      EMContactManager.getInstance().setContactListener(new MyContactListener());
    // ??listener
    EMChatManager.getInstance().addConnectionListener(new MyConnectionListener());
    // ?listener
    //      EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();

}

From source file:com.xuejian.client.lxp.module.toolbox.im.IMMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_im_main);
    initView();/*ww w  .ja v a2  s  .  c o  m*/

    //fragment???
    //      chatHistoryFragment = new ChatHistoryFragment();
    //?fragment
    chatHistoryFragment = new ChatAllHistoryFragment();
    contactListFragment = new ContactlistFragment();
    fragments = new Fragment[] { chatHistoryFragment, contactListFragment };
    if (savedInstanceState == null) {
    } else {
        currentTabIndex = savedInstanceState.getInt("currentTabIndex");
    }
    indicatorViewPager = new IndicatorViewPager(mIMIndicator, mIMViewPager);
    indicatorViewPager.setPageOffscreenLimit(2);
    mIMViewPager.setPrepareNumber(2);
    indicatorViewPager.setAdapter(mIMdapter = new IMMainAdapter(getSupportFragmentManager()));
    indicatorViewPager.setOnIndicatorPageChangeListener(new IndicatorViewPager.OnIndicatorPageChangeListener() {
        @Override
        public void onIndicatorPageChange(int preItem, int currentItem) {
            currentTabIndex = currentItem;
        }
    });

    indicatorViewPager.setCurrentItem(currentTabIndex, false);

    //        EMGroupManager.getInstance().asyncGetGroupsFromServer(new EMValueCallBack<List<EMGroup>>() {
    //            @Override
    //            public void onSuccess(List<EMGroup> emGroups) {
    //                if (chatHistoryFragment != null) {
    //                    chatHistoryFragment.refresh();
    //                }
    //            }
    //
    //            @Override
    //            public void onError(int i, String s) {
    //
    //            }
    //        });
    //?
    getContactFromServer();
    // cmd?BroadcastReceiver
    IntentFilter cmdIntentFilter = new IntentFilter(EMChatManager.getInstance().getCmdMessageBroadcastAction());
    cmdIntentFilter.setPriority(3);
    mContext.registerReceiver(cmdMessageReceiver, cmdIntentFilter);

    // ?BroadcastReceiver
    msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    registerReceiver(msgReceiver, intentFilter);

    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    // ?listener
    groupChangeListener = new MyGroupChangeListener();
    EMGroupManager.getInstance().addGroupChangeListener(groupChangeListener);
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();
}

From source file:com.marvin.rocklock.RockLockActivity.java

@Override
public void onResume() {
    super.onResume();
    // Poke application
    mPoked = false;// w  w w  .ja v  a  2 s  .  c o  m
    new Thread(new PokeWatcher()).start();
    // Restore music
    mPlayer.getNavigator().restore();
    // Register headphone receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_MEDIA_BUTTON);
    filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
    registerReceiver(mMediaButtonReceiver, filter);
}

From source file:com.feytuo.chat.activity.MainActivity.java

public void registerHXListeners() {
    // ?BroadcastReceiver
    Log.i(TAG, "?");
    msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    registerReceiver(msgReceiver, intentFilter);

    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    // ?BroadcastReceiver
    // IntentFilter offlineMessageIntentFilter = new
    // IntentFilter(EMChatManager.getInstance()
    // .getOfflineMessageBroadcastAction());
    // registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter);

    // setContactListener???
    EMContactManager.getInstance().setContactListener(new MyContactListener());
    // ??listener
    EMChatManager.getInstance().addConnectionListener(new MyConnectionListener());
    // ?listener/* w  ww. j a v a2  s  .com*/
    EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();
}

From source file:com.easemob.chatuidemo.activity.MainActivity2.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) {
        // ??home???appcrash
        // fragment??
        DemoApplication.getInstance().logout(null);
        finish();/*from  w  w  w. j ava2s  .c o  m*/
        startActivity(new Intent(this, LoginActivity.class));
        return;
    } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) {
        // T??home???appcrash
        // fragment??
        finish();
        startActivity(new Intent(this, LoginActivity.class));
        return;
    }
    setContentView(R.layout.activity_main2);
    DemoApplication.getInstance().addActivity(this);

    initView();

    //      MobclickAgent.setDebugMode( true );
    //--?--
    MobclickAgent.updateOnlineConfig(this);

    if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) {
        showConflictDialog();
    } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) {
        showAccountRemovedDialog();
    }

    inviteMessgeDao = new InviteMessgeDao(this);
    userDao = new UserDao(this);
    // fragment???
    // chatHistoryFragment = new ChatHistoryFragment();
    // ?fragment
    chatHistoryFragment = new ChatAllHistoryFragment();
    contactListFragment = new ContactlistFragment();
    settingFragment = new SettingsFragment();
    fragments = new Fragment[] { chatHistoryFragment, contactListFragment, settingFragment };
    // fragment
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment)
            .add(R.id.fragment_container, contactListFragment).hide(contactListFragment)
            .show(chatHistoryFragment).commit();

    // ?BroadcastReceiver
    msgReceiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    registerReceiver(msgReceiver, intentFilter);

    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    //??BroadcastReceiver
    IntentFilter cmdMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getCmdMessageBroadcastAction());
    cmdMessageIntentFilter.setPriority(3);
    registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter);

    // ?BroadcastReceiver
    // IntentFilter offlineMessageIntentFilter = new
    // IntentFilter(EMChatManager.getInstance()
    // .getOfflineMessageBroadcastAction());
    // registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter);

    // setContactListener???
    EMContactManager.getInstance().setContactListener(new MyContactListener());
    // ??listener
    EMChatManager.getInstance().addConnectionListener(new MyConnectionListener());
    // ?listener
    EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();

}

From source file:org.linphone.LinphoneService.java

void addCallListner() {

    mIncomingCallReceiver = new IncomingCallReceiver();

    IntentFilter mIntentFilter = new IntentFilter();
    // //  w  w  w  .  j a v a 2  s .co  m
    mIntentFilter.addAction("android.intent.action.PHONE_STATE");
    mIntentFilter.setPriority(1000);
    // 
    //      mIntentFilter.addAction("android.provider.Telephony.SMS_RECEIVED");
    // BroadcastReceiver
    registerReceiver(mIncomingCallReceiver, mIntentFilter);
    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    // endcall
    TelephonyManager mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

    try {
        Method getITelephonyMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", (Class[]) null);
        getITelephonyMethod.setAccessible(true);
        //       mITelephony = (ITelephony)
        getITelephonyMethod.invoke(mTelephonyManager, (Object[]) null);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:the.joevlc.AudioService.java

@Override
public void onCreate() {
    super.onCreate();

    // Get libVLC instance
    try {// ww w .j  ava2s .c om
        mLibVLC = LibVLC.getInstance();
    } catch (LibVlcException e) {
        e.printStackTrace();
    }

    Thread.setDefaultUncaughtExceptionHandler(new VlcCrashHandler());

    mCallback = new HashMap<IAudioServiceCallback, Integer>();
    mMediaList = new ArrayList<Media>();
    mPrevious = new Stack<Media>();
    mEventManager = EventManager.getInstance();
    mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(),
            RemoteControlClientReceiver.class.getName());

    // Make sure the audio player will acquire a wake-lock while playing. If we don't do
    // that, the CPU might go to sleep while the song is playing, causing playback to stop.
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);

    IntentFilter filter = new IntentFilter();
    filter.setPriority(Integer.MAX_VALUE);
    filter.addAction(ACTION_REMOTE_BACKWARD);
    filter.addAction(ACTION_REMOTE_PLAYPAUSE);
    filter.addAction(ACTION_REMOTE_PLAY);
    filter.addAction(ACTION_REMOTE_PAUSE);
    filter.addAction(ACTION_REMOTE_STOP);
    filter.addAction(ACTION_REMOTE_FORWARD);
    filter.addAction(ACTION_REMOTE_LAST_PLAYLIST);
    filter.addAction(Intent.ACTION_HEADSET_PLUG);
    filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
    filter.addAction(VLCApplication.SLEEP_INTENT);
    registerReceiver(serviceReceiver, filter);

    final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
    boolean stealRemoteControl = pref.getBoolean("steal_remote_control", false);

    if (!Util.isFroyoOrLater() || stealRemoteControl) {
        /* Backward compatibility for API 7 */
        filter = new IntentFilter();
        if (stealRemoteControl)
            filter.setPriority(Integer.MAX_VALUE);
        filter.addAction(Intent.ACTION_MEDIA_BUTTON);
        mRemoteControlClientReceiver = new RemoteControlClientReceiver();
        registerReceiver(mRemoteControlClientReceiver, filter);
    }

    AudioUtil.prepareCacheFolder(this);
}

From source file:org.linphone.LinphoneService.java

public void initFromConf() throws LinphoneConfigException, LinphoneException {
    // traces//from  w  w  w .  j  a v a  2 s. c  om
    boolean lIsDebug = mPref.getBoolean(getString(R.string.pref_debug_key), false);
    LinphoneCoreFactory.instance().setDebugMode(lIsDebug);

    try {
        // Configure audio codecs
        enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
        enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key);
        enableDisableAudioCodec("speex", 8000, R.string.pref_codec_speex8_key);
        enableDisableAudioCodec("iLBC", 8000, R.string.pref_codec_ilbc_key);
        enableDisableAudioCodec("GSM", 8000, R.string.pref_codec_gsm_key);
        enableDisableAudioCodec("PCMU", 8000, R.string.pref_codec_pcmu_key);
        enableDisableAudioCodec("PCMA", 8000, R.string.pref_codec_pcma_key);

        // Configure video codecs
        for (PayloadType videoCodec : mLinphoneCore.listVideoCodecs()) {
            enableDisableVideoCodecs(videoCodec);
        }
        if (!mPref.getString(getString(R.string.pref_handle_outcall_key), OutgoingCallReceiver.key_on_demand)
                .equalsIgnoreCase(OutgoingCallReceiver.key_off)) {
            IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
            lFilter.setPriority(0);
            lFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL);
            if (mOutgoingCallReceiver == null) {
                mOutgoingCallReceiver = new OutgoingCallReceiver();
            }
            registerReceiver(mOutgoingCallReceiver, lFilter);
        } else if (mOutgoingCallReceiver != null) {
            unregisterReceiver(mOutgoingCallReceiver);
            mOutgoingCallReceiver = null;
        }

        mLinphoneCore.enableEchoCancellation(
                mPref.getBoolean(getString(R.string.pref_echo_cancellation_key), false));
    } catch (LinphoneCoreException e) {
        throw new LinphoneConfigException(getString(R.string.wrong_settings), e);
    }
    boolean isVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
    mLinphoneCore.enableVideo(isVideoEnabled, isVideoEnabled);
    // 1 read proxy config from preferences
    String lUserName = mPref.getString(getString(R.string.pref_username_key), null);
    lUserName = username;
    if (lUserName == null || lUserName.length() == 0) {
        throw new LinphoneConfigException(getString(R.string.wrong_username));
    }

    String lPasswd = mPref.getString(getString(R.string.pref_passwd_key), null);
    lPasswd = password;
    if (lPasswd == null || lPasswd.length() == 0) {
        throw new LinphoneConfigException(getString(R.string.wrong_passwd));
    }

    String lDomain = mPref.getString(getString(R.string.pref_domain_key), null);
    lDomain = domain;
    if (lDomain == null || lDomain.length() == 0) {
        throw new LinphoneConfigException(getString(R.string.wrong_domain));
    }

    String lStun = mPref.getString(getString(R.string.pref_stun_server_key), null);

    // stun server
    mLinphoneCore.setStunServer(lStun);
    mLinphoneCore.setFirewallPolicy(
            (lStun != null && lStun.length() > 0) ? FirewallPolicy.UseStun : FirewallPolicy.NoFirewall);

    // auth
    mLinphoneCore.clearAuthInfos();
    LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(lUserName, lPasswd, null);
    mLinphoneCore.addAuthInfo(lAuthInfo);

    // proxy
    mLinphoneCore.clearProxyConfigs();
    String lProxy = mPref.getString(getString(R.string.pref_proxy_key), null);
    if (lProxy == null || lProxy.length() == 0) {
        lProxy = "sip:" + lDomain;
    }
    if (!lProxy.startsWith("sip:")) {
        lProxy = "sip:" + lProxy;
    }
    // get Default proxy if any
    LinphoneProxyConfig lDefaultProxyConfig = mLinphoneCore.getDefaultProxyConfig();
    String lIdentity = "sip:" + lUserName + "@" + lDomain;
    try {
        if (lDefaultProxyConfig == null) {
            lDefaultProxyConfig = LinphoneCoreFactory.instance().createProxyConfig(lIdentity, lProxy, null,
                    true);
            mLinphoneCore.addProxyConfig(lDefaultProxyConfig);
            mLinphoneCore.setDefaultProxyConfig(lDefaultProxyConfig);

        } else {
            lDefaultProxyConfig.edit();
            lDefaultProxyConfig.setIdentity(lIdentity);
            lDefaultProxyConfig.setProxy(lProxy);
            lDefaultProxyConfig.enableRegister(true);
            lDefaultProxyConfig.done();
        }
        lDefaultProxyConfig = mLinphoneCore.getDefaultProxyConfig();

        if (lDefaultProxyConfig != null) {
            // prefix
            String lPrefix = mPref.getString(getString(R.string.pref_prefix_key), null);
            if (lPrefix != null) {
                lDefaultProxyConfig.setDialPrefix(lPrefix);
            }
            // escape +
            lDefaultProxyConfig
                    .setDialEscapePlus(mPref.getBoolean(getString(R.string.pref_escape_plus_key), false));
            // outbound proxy
            if (mPref.getBoolean(getString(R.string.pref_enable_outbound_proxy_key), false)) {
                lDefaultProxyConfig.setRoute(lProxy);
            } else {
                lDefaultProxyConfig.setRoute(null);
            }

        }
        // init network state
        ConnectivityManager lConnectivityManager = (ConnectivityManager) getSystemService(
                Context.CONNECTIVITY_SERVICE);
        NetworkInfo lInfo = lConnectivityManager.getActiveNetworkInfo();
        mLinphoneCore.setNetworkReachable(lInfo != null
                ? lConnectivityManager.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED
                : false);

    } catch (LinphoneCoreException e) {
        throw new LinphoneConfigException(getString(R.string.wrong_settings), e);
    }
}

From source file:com.fullteem.yueba.app.ui.MainActivity.java

@Override
public void initData() {
    LogUtil.LogDebug("?", "Fragment:" + System.currentTimeMillis(), null);
    mListener = new MyListener();
    // for fragent
    mFragments = new ArrayList<Fragment>(PAGE_TOATAL);
    mFragments.add(NearbyMainFragment.getInstance());
    mFragments.add(MessageMainFragment.getInstance());
    mFragments.add(DiscoverMainFragment.getInstance());
    mFragments.add(PersonalMainFragment.getInstance());

    for (int i = 0; i < mFragments.size(); i++) {
        getSupportFragmentManager().beginTransaction().add(R.id.ll_fragmentcontainer, mFragments.get(i))
                .commit();/*from ww w .j  ava 2  s  .com*/
    }
    ((NearbyMainFragment) mFragments.get(0)).onLuckyMeet();

    // for show image
    int[] imgId = { R.drawable.img_main_nearby, R.drawable.img_main_message, R.drawable.img_main_discover,
            R.drawable.img_main_personal, R.drawable.img_main_nearby_selected,
            R.drawable.img_main_message_selected, R.drawable.img_main_discover_selected,
            R.drawable.img_main_personal_selected };
    mImgUnSelected = new ArrayList<Drawable>(PAGE_TOATAL);
    for (int i = 0; i < PAGE_TOATAL; i++) {
        Drawable drawable = getResources().getDrawable(imgId[i]);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        mImgUnSelected.add(drawable);
    }
    mImgSelected = new ArrayList<Drawable>(PAGE_TOATAL);
    for (int i = 4; i < imgId.length; i++) {
        Drawable drawable = getResources().getDrawable(imgId[i]);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        mImgSelected.add(drawable);
    }

    // ??
    inviteMessgeDao = new InviteMessgeDao(this);
    userDao = new UserDao(this);
    // ?BroadcastReceiver
    msgReceiver = new NewYBMessageBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    intentFilter.setPriority(3);
    registerReceiver(msgReceiver, intentFilter);
    // ack?BroadcastReceiver
    IntentFilter ackMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(3);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    // ??BroadcastReceiver
    IntentFilter cmdMessageIntentFilter = new IntentFilter(
            EMChatManager.getInstance().getCmdMessageBroadcastAction());
    cmdMessageIntentFilter.setPriority(3);
    registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter);

    // setContactListener???
    EMContactManager.getInstance().setContactListener(new MyContactListener());
    // ??listener
    EMChatManager.getInstance().addConnectionListener(new MyConnectionListener());
    // ?listener
    EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener());
    // sdkUI ??receiverlistener, ??broadcast
    EMChat.getInstance().setAppInited();
    LogUtil.LogDebug("?", "MainActivity ??:" + System.currentTimeMillis(), null);
}