当前位置: 首页>>代码示例>>Java>>正文


Java IntentFilter.getAction方法代码示例

本文整理汇总了Java中android.content.IntentFilter.getAction方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.getAction方法的具体用法?Java IntentFilter.getAction怎么用?Java IntentFilter.getAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.IntentFilter的用法示例。


在下文中一共展示了IntentFilter.getAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unregisterReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void unregisterReceiver(BroadcastReceiver receiver) {
    synchronized (this.mReceivers) {
        ArrayList<IntentFilter> filters = (ArrayList) this.mReceivers.remove(receiver);
        if (filters == null) {
            return;
        }
        for (int i = 0; i < filters.size(); i++) {
            IntentFilter filter = (IntentFilter) filters.get(i);
            for (int j = 0; j < filter.countActions(); j++) {
                String action = filter.getAction(j);
                ArrayList<ReceiverRecord> receivers = (ArrayList) this.mActions.get(action);
                if (receivers != null) {
                    int k = 0;
                    while (k < receivers.size()) {
                        if (((ReceiverRecord) receivers.get(k)).receiver == receiver) {
                            receivers.remove(k);
                            k--;
                        }
                        k++;
                    }
                    if (receivers.size() <= 0) {
                        this.mActions.remove(action);
                    }
                }
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:29,代码来源:LocalBroadcastManager.java

示例2: registerReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
/**
 * Register a receive for any local broadcasts that match the given IntentFilter.
 *
 * @param receiver The BroadcastReceiver to handle the broadcast.
 * @param filter Selects the Intent broadcasts to be received.
 *
 * @see #unregisterReceiver
 */
public void registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
    if (RePluginFramework.mHostInitialized) {
        try {
            ProxyLocalBroadcastManagerVar.registerReceiver.call(sOrigInstance, receiver, filter);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return;
    }
    synchronized (mReceivers) {
        ReceiverRecord entry = new ReceiverRecord(filter, receiver);
        ArrayList<IntentFilter> filters = mReceivers.get(receiver);
        if (filters == null) {
            filters = new ArrayList<IntentFilter>(1);
            mReceivers.put(receiver, filters);
        }
        filters.add(filter);
        for (int i=0; i<filter.countActions(); i++) {
            String action = filter.getAction(i);
            ArrayList<ReceiverRecord> entries = mActions.get(action);
            if (entries == null) {
                entries = new ArrayList<ReceiverRecord>(1);
                mActions.put(action, entries);
            }
            entries.add(entry);
        }
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:37,代码来源:PluginLocalBroadcastManager.java

示例3: unregisterReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
/**
 * Unregister a previously registered BroadcastReceiver.  <em>All</em>
 * filters that have been registered for this BroadcastReceiver will be
 * removed.
 *
 * @param receiver The BroadcastReceiver to unregister.
 *
 * @see #registerReceiver
 */
public void unregisterReceiver(BroadcastReceiver receiver) {
    if (RePluginFramework.mHostInitialized) {
        try {
            ProxyLocalBroadcastManagerVar.unregisterReceiver.call(sOrigInstance, receiver);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return;
    }
    synchronized (mReceivers) {
        ArrayList<IntentFilter> filters = mReceivers.remove(receiver);
        if (filters == null) {
            return;
        }
        for (int i=0; i<filters.size(); i++) {
            IntentFilter filter = filters.get(i);
            for (int j=0; j<filter.countActions(); j++) {
                String action = filter.getAction(j);
                ArrayList<ReceiverRecord> receivers = mActions.get(action);
                if (receivers != null) {
                    for (int k=0; k<receivers.size(); k++) {
                        if (receivers.get(k).receiver == receiver) {
                            receivers.remove(k);
                            k--;
                        }
                    }
                    if (receivers.size() <= 0) {
                        mActions.remove(action);
                    }
                }
            }
        }
    }
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:44,代码来源:PluginLocalBroadcastManager.java

示例4: unregisterReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void unregisterReceiver(BroadcastReceiver receiver) {
    HashMap var2 = this.mReceivers;
    synchronized (this.mReceivers) {
        ArrayList filters = (ArrayList) this.mReceivers.remove(receiver);
        if (filters != null) {
            for (int i = 0; i < filters.size(); ++i) {
                IntentFilter filter = (IntentFilter) filters.get(i);

                for (int j = 0; j < filter.countActions(); ++j) {
                    String action = filter.getAction(j);
                    ArrayList receivers = (ArrayList) this.mActions.get(action);
                    if (receivers != null) {
                        for (int k = 0; k < receivers.size(); ++k) {
                            if (((LocalBroadcastManager.ReceiverRecord) receivers.get(k)).receiver == receiver) {
                                receivers.remove(k);
                                --k;
                            }
                        }

                        if (receivers.size() <= 0) {
                            this.mActions.remove(action);
                        }
                    }
                }
            }

        }
    }
}
 
开发者ID:AnyRTC,项目名称:anyRTC-P2P-Android,代码行数:30,代码来源:LocalBroadcastManager.java


注:本文中的android.content.IntentFilter.getAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。