Click here to Skip to main content
15,850,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i tried many solutions which i found them in internet related with this subject none of them worked yet. help me.
program does not give errors but no solution...
for example one program which does not work is


package com.xxx.xx;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
public class Dosya_Indir007 extends Activity {

private static String file_url = "http://application2.ibb.gov.tr/OzurlulerVids/images/Hurma.flv";

WebView webView;
String htmlPre = "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"></head><body style='margin:0; pading:0; background-color: black;'>";
String htmlCode = " <embed style='width:100%; height:100%' src='http://www.platipus.nl/flvplayer/download/1.0/FLVPlayer.swf?fullscreen=true&video=@VIDEO@' " + " autoplay='true' " + " quality='high' bgcolor='#000000' " + " name='VideoPlayer' align='middle'" + // width='640' height='480'
" allowScriptAccess='*' allowFullScreen='true'" + " type='application/x-shockwave-flash' " +
" pluginspage='http://www.macromedia.com/go/getflashplayer' />" + "";
String htmlPost = "</body></html>";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dosya_indir);
webView = (WebView)findViewById(R.id.webView1);


webView.setWebChromeClient(new WebChromeClient());



webView.getSettings().setAllowFileAccess(true);


webView.setHorizontalScrollBarEnabled(false);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);

webView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
String video_link = file_url;
//thanks Patrick!
htmlCode = htmlCode.replaceAll("@VIDEO@", video_link);

System.out.println(htmlPre+htmlCode+htmlPost);
webView.loadDataWithBaseURL("fake://fake/fake", htmlPre+htmlCode+htmlPost, "text/html", "UTF-8", null); } @Override protected void onPause(){
super.onPause();
callHiddenWebViewMethod("onPause");
webView.pauseTimers();
if(isFinishing()){
webView.loadUrl("about:blank");
setContentView(new FrameLayout(this));
}
}
@Override
protected void onResume(){
super.onResume();
callHiddenWebViewMethod("onResume");
webView.resumeTimers();
}
private void callHiddenWebViewMethod(String name){
// credits: http://stackoverflow.com/questions/3431351/how-do-i-pause-flash-content-in-an-android-webview-when-my-activity-isnt-visible
if( webView != null ){
try {
Method method = WebView.class.getMethod(name);
method.invoke(webView); }
catch (NoSuchMethodException e) {
Log.d("No such method: " + name + e,""); }
catch (IllegalAccessException e) {
Log.d("Illegal Access: " + name + e,""); }
catch (InvocationTargetException e) {
Log.d("Invocation Target Exception: " + name + e,""); }
}
}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900