0

I want to build an app in App Inventor, I am unable to do it in Eclipse. I want to build a webpage in the app. How do I open a webpage in the app, and not in the browser?

I have tried this:

ActivityStarter1
Action:android.intent.action.VIEW
DataUri:http://example.com 

But it's opening in the browser only.

1

4 Answers 4

1

start a new activity with WebView in activity_web_view.xml

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view);
    webView = (WebView) findViewById(R.id.webView1);
                webView.getSettings().setJavaScriptEnabled(true);
                webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
                webView.setBackgroundColor(0);

                webView.setWebViewClient(new WebViewClient(){


                    public void onReceivedError(WebView view, int errorCode,
                            String description, String failingUrl) {
                        super.onReceivedError(view, errorCode, description, failingUrl);

                    }


                    public void onPageStarted(WebView view, String url, Bitmap favicon) {
                        super.onPageStarted(view, url, favicon);

                        Toast.makeText(getApplicationContext(),"loading...", Toast.LENGTH_LONG).show();
                    }


                    public void onPageFinished(WebView view, String url) {
                        super.onPageFinished(view, url);

                        Toast.makeText(getApplicationContext(),"loaded", Toast.LENGTH_LONG).show();
                    }

                });
                webView.getSettings().setPluginState(PluginState.ON); 
                webView.loadUrl("http://stackoverflow.com");
3
  • i want to know app inventor method unable to do it via eclipse Sep 4, 2015 at 9:22
  • no any other way to open url in the app without WebView Sep 4, 2015 at 10:47
  • this is an App Inventor question and therefore your answer will not help very much...
    – Taifun
    Sep 4, 2015 at 14:39
0

use a Webviewer component like this

enter image description here

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks. There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

0

You need to use WebView.

Add it to your activity like this

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

and then provide url like this (for instance in the onCreate of the Activity):

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");

you also need to provide the internet access permission in the manifest file

<uses-permission android:name="android.permission.INTERNET" />

For details look at http://developer.android.com/guide/webapps/webview.html

2
  • this is an App Inventor question and therefore your answer will not help very much...
    – Taifun
    Sep 4, 2015 at 14:39
  • Correct, in the question it was not capitalized when it was first posted and I missed it. Sorry. Your answer looks great. Sep 5, 2015 at 6:52
0

first of all you need to make that web page on default browser by using html code or any programing app or web page maker, then convert that page into apk file.

<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

If you want to deliver a web application (or) just a web page as a part of a client application, you can do it using WebView. The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page. Then convert that page through app studio

</xml version="2.0" encoding="utf=-8"?>
<webview xmlns:android="http://example.com/apk/res/android/version"

   android:id="@+id/webview"
   android:layout_witdth_height="fill parent"

<manifest ... >
  <uses-permission android:name="android.permission.INTERNET" />
...
</manifest>

<,xml version="3.0" encoding="utf-9"?>
1
  • this is an App Inventor question and therefore your answer will not help very much...
    – Taifun
    Sep 4, 2015 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.