github.com/c-darwin/mobile@v0.0.0-20160313183840-ff625c46f7c9/app/XWalkActivity.java (about) 1 package org.golang.app; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.content.Intent; 6 import android.util.Log; 7 import android.net.Uri; 8 import android.os.Handler; 9 import android.os.SystemClock; 10 import java.util.concurrent.TimeUnit; 11 import org.xwalk.core.XWalkView; 12 import android.widget.LinearLayout; 13 import android.util.Log; 14 import android.view.Window; 15 import android.view.WindowManager; 16 import android.content.pm.ActivityInfo; 17 18 public class WViewActivity extends Activity { 19 20 static { 21 try { 22 System.loadLibrary("xwalkcore"); 23 } catch (UnsatisfiedLinkError e) { 24 System.err.println("xwalkcore code library failed to load 02.\n" + e); 25 System.exit(1); 26 } 27 Log.d("Go", "xwalkcore loaded"); 28 29 try { 30 System.loadLibrary("xwalkdummy"); 31 } catch (UnsatisfiedLinkError e) { 32 System.err.println("xwalkdummy code library failed to load 03.\n" + e); 33 System.exit(1); 34 } 35 Log.d("Go", "xwalkdummy loaded"); 36 } 37 38 private LinearLayout commentsLayout; 39 private XWalkView mXWalkView; 40 41 @Override 42 protected void onCreate(Bundle savedInstanceState) { 43 super.onCreate(savedInstanceState); 44 45 //Fixed Portrait orientation 46 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 47 48 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 49 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 50 WindowManager.LayoutParams.FLAG_FULLSCREEN); 51 52 Log.d("Go", "WViewActivity onCreate"); 53 setContentView(R.layout.activity_xwalk_embed_lib); 54 commentsLayout=(LinearLayout)findViewById(R.id.principal); 55 mXWalkView = new XWalkView(this, this); 56 //final String html = "<html><body bgcolor=\"#090998\"><h1>Hello world!</h1></body></html>"; 57 mXWalkView.load("http://localhost:8089", null); 58 commentsLayout.addView(mXWalkView); 59 60 Log.d("Go", "mXWalkView ok"); 61 } 62 63 protected void onStart(Bundle savedInstanceState) { 64 65 Log.d("Go", "MainActivity onStart"); 66 67 } 68 69 }