大佬教程收集整理的这篇文章主要介绍了android – 从广播接收器完成活动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Intent local = new Intent(); local.setAction("com.Hello.action"); sendBroadcast(local);@H_403_7@现在在活动中抓住这个意图,你想要完成它,然后在接收器的onReceive方法上调用super.finish()
像这样public class filenamefilter extends Activity { ArrayAdapter<String> adapter; @Override public void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); IntentFilter filter = new IntentFilter(); filter.addAction("com.Hello.action"); registerReceiver(receiver,filter); } BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context,Intent intent) { finish(); } }; public void finish() { super.finish(); }; }@H_403_7@这将完成活动
以上是大佬教程为你收集整理的android – 从广播接收器完成活动全部内容,希望文章能够帮你解决android – 从广播接收器完成活动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。