androidwebview加载ppt,如何在Android的WebView中打开
PPT演。。。
第⼀个XML⽂件:-
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true">
主要活动:-
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String request)
{
try{
HitTestResult().getExtra().endsWith(".pptx"))
{
try
{
Intent intent=new Intent(MainActivity.this,Main2Activity.class);
intent.putExtra("url",HitTestResult().getExtra());
startActivity(intent);
return true;
}
catch (Exception e)
{
Toast.makeText(MainActivity.this, e+"", Toast.LENGTH_SHORT).show();
}
return true;
}
else
{
webView.loadUrl(request);
return true;
}}
catch (Exception e)
{
return false;
}
}
public class Main2Activity extends AppCompatActivity { WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
setContentView(R.layout.activity_main2);
Intent intent=getIntent();
String StringExtra("url");
String s="le/viewer?url=";
at(t);
webView=(WebView)findViewById(R.id.webView); webView.loadUrl(s);
}
@Override
protected void onResume()
{
this.finish();
}
xml文件怎么打开第⼆个XML⽂件:-
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
发布评论