6 Replies - 700 Views - Last Post: 17 March 2012 - 10:19 PM

#1 JDoggChris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-September 08

Web view isn't working in my small noob project

Posted 14 March 2012 - 05:04 AM

Hi guys, started "developing" for Android about.... 5 minutes ago, pretty limited past programming experience, little HTML PHP CSS and a little less JAVA, I'm a complete Android programming noob so I wanted to start with a very simple app that is a web view to connect to my home server and load a html page, pretty straightforward I think. Only problem is I can't get web view working, here is my code.
package com.test.helloworld;

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

public class HiworldActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        WebView webview = new WebView(this);
        setContentView(webview);
        webview.loadUrl("http://www.google.com");
    }
}

The page doesn't load, while the same page loads in the browser (see pics).
Posted Image
Posted Image
I hope my post is detailed enough to get some assistance, thanks guys :).

Is This A Good Question/Topic? 0
  • +

Replies To: Web view isn't working in my small noob project

#2 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 147
  • View blog
  • Posts: 983
  • Joined: 13-March 09

Re: Web view isn't working in my small noob project

Posted 14 March 2012 - 07:37 AM

Have you added uses-permission for Internet?

Go into your project. Open the "AndroidManifest.xml" and select the tab that shows you the code.

Just above the line that says <uses-sdk android:minSdkVersion....etc.
you should have the following
<uses-permission android:name="android.permission.INTERNET" /> 

Was This Post Helpful? 1
  • +
  • -

#3 JDoggChris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-September 08

Re: Web view isn't working in my small noob project

Posted 14 March 2012 - 03:11 PM

View PostEndLessMind, on 14 March 2012 - 07:37 AM, said:

Have you added uses-permission for Internet?

Go into your project. Open the "AndroidManifest.xml" and select the tab that shows you the code.

Just above the line that says <uses-sdk android:minSdkVersion....etc.
you should have the following
<uses-permission android:name="android.permission.INTERNET" /> 

Ahhhh thank you!, no I didn't add any permissions, I guess that's what I get for not reading the tutorial properly. My next problem is that the html page has a login box, simple auth username and password, how can I get user input and store that information to use on the web view?
Was This Post Helpful? 0
  • +
  • -

#4 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 147
  • View blog
  • Posts: 983
  • Joined: 13-March 09

Re: Web view isn't working in my small noob project

Posted 14 March 2012 - 03:19 PM

Your welcome. I would appreciate if you voted the post as helpful :)

Hm, about the other problem. Well, i haven't been working with web-browser for a long time. But some small piece of my brain says that you would look in to cookies :)
Was This Post Helpful? 1
  • +
  • -

#5 JDoggChris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-September 08

Re: Web view isn't working in my small noob project

Posted 14 March 2012 - 03:25 PM

View PostEndLessMind, on 14 March 2012 - 03:19 PM, said:

Your welcome. I would appreciate if you voted the post as helpful :)

Hm, about the other problem. Well, i haven't been working with web-browser for a long time. But some small piece of my brain says that you would look in to cookies :)

Voted. Thanks for your help, once I get home I'll try it out and get back to you.
Was This Post Helpful? 0
  • +
  • -

#6 JDoggChris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-September 08

Re: Web view isn't working in my small noob project

Posted 15 March 2012 - 12:07 AM

View PostEndLessMind, on 14 March 2012 - 03:19 PM, said:

Your welcome. I would appreciate if you voted the post as helpful :)

Hm, about the other problem. Well, i haven't been working with web-browser for a long time. But some small piece of my brain says that you would look in to cookies :)

I got it working and I'm pretty proud of myself :P Any recommended reading to get me started?
Was This Post Helpful? 0
  • +
  • -

#7 EndLessMind  Icon User is offline

  • These are the droids you're looking for
  • member icon

Reputation: 147
  • View blog
  • Posts: 983
  • Joined: 13-March 09

Re: Web view isn't working in my small noob project

Posted 17 March 2012 - 10:19 PM

I've not been working with webbrowser in Android at all, only in VB.net and c#
But maybe this can help :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1