Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Carregar swf dentro do WebView

chegaste a habilitar os plugins? o comando seria:
    webview.getSettings().setPluginsEnabled(true);


Maicon Strey
Novo Hamburgo - RS - Brasil
------------------
------------------
Linux user: #525086


On Mon, Apr 1, 2013 at 1:42 PM, Felipe Cauê Legal Benedito <felipecaue.lb@gmail.com> wrote:
Gostaria de carregar um swf dentro do webview, porem não estou conseguindo.
Eu gero o apk, instalo no celular, abro o app mas não aparece nada.

MainActivity.java

import android.os.Bundle;
import android.app.Activity;
import android.graphics.Color;
import android.webkit.WebView;

public class MainActivity extends Activity {
WebView mWebView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webView1);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setBackgroundColor(Color.parseColor("#c3c3c3"));
mWebView.loadUrl("file:///android_asset/meuArquivo.swf");
}

}


activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

</RelativeLayout>


AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
    package="com.darkreddragon"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:name="com.darkreddragon.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>



Eu coloquei o arquivo swf na pasta assets, será que não está conseguindo ler a pasta?

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário