opening local html file with Android Browser

前端 未结 3 1623
无人共我
无人共我 2020-12-11 01:55

i\'m trying to open a local html file using the default browser using the following code:

Uri uri = Uri.fromFile(file);
Intent browserIntent = new Intent(Int         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-11 02:37

        Uri uri = Uri.fromFile(file);
        Intent browserIntent = new Intent(Intent.ACTION_VIEW);
        browserIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
        browserIntent.setData(uri);
        startActivity(browserIntent);
    

提交回复
热议问题