3

How can you create app in Android that iframes a website in Eclipse. What's the code for it?

Thanks in advance!

4 Answers 4

14

I always preffer an example , like this :

First put in an xml layout this:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> 

Then in an Activity class , use this in onCreate:

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webview; webview = (WebView) findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www.google.com"); } 
Sign up to request clarification or add additional context in comments.

1 Comment

is that legal on Android? I mean, you cannot publish an app with iframes at least on iOS
0

If I understood well (which is not sure at all), what you want to do is a WebApplication in android (using the SDK, hence your reference to eclipse).

Such applications behave like a custom web-browser. Basically it's a full screen WebView but you can customize virtually anything.

I think a good starting point is this android developer tutorial

Comments

0

http://developer.android.com/reference/android/webkit/WebView.html

A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.

Comments

0

using a webview do what u want!

in the layouts create a webview element like this:

<WebView android:id="@+id/my_web_view" android:layout_width="fill_parent" android:layout_height="fill_parent" /> 

then in the activity u must initialize it and use webview loadurl method!

if u want more information about this best place developers.android.com and go to reference section and select webview to see all available methods and usage guide!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.