天文文件浏览器和意图

我能得到天文推出我的活动时,我选择了一个特定的文件类型。 但是,我不知道怎么抢我的意图活动开始的时候!

public class Viewer extends ListActivity{ .... // Flag if receiver is registered private boolean mReceiversRegistered = false; // I think this is the broadcast you need for something like an incoming call private String INCOMING_CALL_ACTION = "android.intent.action.VIEW"; // Define a handler and a broadcast receiver private final Handler mHandler = new Handler(); private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // Handle reciever String mAction = intent.getAction(); Toast.makeText(context,"Found with passed context", Toast.LENGTH_LONG).show(); Toast.makeText(BallLidarViewer.this, "Found with my context", toast.LENGTH_LONG).show(); System.out.print("FOUND"); Log.d("FOUND","FOUND"); if(mAction.equals(INCOMING_CALL_ACTION)) { // Do your thing } } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); .... } }

我不能让我的任何测试输出的代码我的活动启动时运行。 我究竟做错了什么? 谢谢!

--------------解决方案-------------

如果我得到你的权利,你可以简单地调用getIntent在你onCreate方法。

要获得意图束,呼吁意图getExtras。

分类:安卓 时间:2015-03-15 人气:0
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.518 (s). 10 q(s)