मैं स्थानीय फ़ाइल खोलने के लिए ब्राउज़र को मंशा भेजने की कोशिश कर रहा हूं। मैं इस फ़ाइल को खोलने के लिए डिफ़ॉल्ट ब्राउज़र का उपयोग करना चाहता हूं।स्थानीय फ़ाइल खोलने के लिए ब्राउज़र लॉन्च कैसे करें
if(file.exists()){
Log.d(TAG, "file.exists");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
context.startActivity(intent);
}
लेकिन यह मेरे और अपवाद
08-10 13:27:58.993: ERROR/AndroidRuntime(28453): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///sdcard/release_notes.htm }
फेंकता मैं आशय ब्राउज़र निम्नलिखित का उपयोग करते हैं google.com खोलता उम्मीद
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com"));
इसके अलावा जब मैं ब्राउज़र पता करने के लिए फ़ाइल यूआरएल (file:///sdcard/release_notes.htm)
लिखने के रूप में बार यह इसे उम्मीद के रूप में खोलता है।
'08-10 14: 03: 48.414: त्रुटि/एंड्रॉइड रनटाइम (2 9 612): android.content.ActivityNotFoundException: इरादा को संभालने के लिए कोई गतिविधि नहीं मिली {act = android.intent.action.VIEW बिल्ली = [android.intent.category.BROWSABLE] डेटा = फ़ाइल: ///sdcard/release_notes.htm} ' – roose
हम्म, अजीब, मुझे अपने फोन पर इसके साथ कोई समस्या नहीं है :(- दोबारा जांचें कि जब आप इसे आज़माते हैं तो sdcard कंप्यूटर पर नहीं लगाया जाता है। – Zharf
हो सकता है कि आप स्पष्ट रूप से इरादे से ब्राउजर क्लासनाम जोड़ने का प्रयास कर सकें: 'intent.setClassName (" com.android.browser "," com.android.browser.BrowserActivity "); ' – Zharf