小编Roh*_*ami的帖子

离线时在 webview 中加载 pdf

如何将 PDF 嵌入 HTML 并在 Web 视图中显示?其实我正在尝试这个但是webview没有加载这个页面。

    String base = Environment.getExternalStorageDirectory().getAbsolutePath().toString();
            String pdfPath = base + "/Principal.pdf";
             Log.e("real path =", ""+pdfPath);
            web.getSettings().setJavaScriptEnabled(true);
            web.getSettings().setAllowFileAccess(true);
            web.getSettings().setBuiltInZoomControls(true);
            web.loadDataWithBaseURL("", 
                    "<embed src='"+pdfPath+"' width='500' height='375'>",
                    "application/pdf",
                    "utf-8",
                    "");
Run Code Online (Sandbox Code Playgroud)

pdf android webview

5
推荐指数
1
解决办法
2879
查看次数

通过 Webview 卡在 Linkedin 登录中

实际上,我的应用程序是通过linkedin 应用程序和webview 使用linkedin 登录的。使用linkedin 登录工作正常,但如果linkedin 应用程序不可用,我将使用webview 来处理登录。这也工作正常,但今天它突然卡在了一些代码异常中。我在我的 Linkedin 对话框类中获得了空访问令牌,所以我喜欢放置 try catch 但之后它会显示空白的 webview 我不知道该怎么做知道。这是我的linkedin对话框代码

public class LinkedinDialog extends Dialog
{
private ProgressDialog progressDialog = null;

public static LinkedInApiClientFactory factory;
public static LinkedInOAuthService oAuthService;
public static LinkedInRequestToken liToken;
private WebView mWebView;
private Context mContext;

public LinkedinDialog(Context context, ProgressDialog progressDialog) 
{
    super(context);
    mContext = context;
    this.progressDialog = progressDialog;
}

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    requestWindowFeature(Window.FEATURE_NO_TITLE);// must call before super.
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ln_dialog);
    setWebView();
}

/**
 * set webview.
 */
private void setWebView() …
Run Code Online (Sandbox Code Playgroud)

android exception linkedin linkedin-api

5
推荐指数
1
解决办法
1076
查看次数

标签 统计

android ×2

exception ×1

linkedin ×1

linkedin-api ×1

pdf ×1

webview ×1