以下是在我的适配器中调用活动。
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent in = new Intent(mContext, PdfViewActivity.class);
in.putExtra("path", curr.getContry());
in.putExtra("name", curr.getDis());
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(in);
}
});
我的veb视图如下
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.shuan.Project.R;
public class PdfViewActivity extends AppCompatActivity {
private WebView web;
private Toolbar toolbar;
private String path = "http://www.example.com/sample.pdf";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pdf_view);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar.setTitle("Candidate : "+getIntent().getStringExtra("name"));
web = (WebView) findViewById(R.id.my_web);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setPluginState(WebSettings.PluginState.ON);
web.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
});
web.loadUrl("https://docs.google.com/gview?embedded=true&url=" +getIntent().getStringExtra("path"));
//Toast.makeText(getApplicationContext(),getIntent().getStringExtra("path"),Toast.LENGTH_SHORT).show();
}
}
虽然我正在尝试查看我的webview中的独特功能,但看到的是html标签等等。我该怎么办?我想将内容加载到我的webview中,该内容保存在我的数据库中,我通过链接获取它。我错了吗?