0
當我選擇某種文件類型時,我能夠讓Astro啓動我的活動。但是,當我的活動開始時,我不知道如何抓住意圖!Astro文件瀏覽器和意圖
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);
....
}
}
當我的活動開始時,我無法獲得任何測試輸出代碼。我究竟做錯了什麼?謝謝!
我也考慮過這個問題,但我不知道如何從文件路徑中獲取文件路徑(這是我想要的)。有沒有辦法查看意圖中包含的數據? – RedLeader