Problem with WebView.loadUrl() method

grigoris

New Member
Hi.I'm trying to display a webpage with WebView class, using loadUrl method.But the webpage is not loading, instead i get a "Web page not available" message.:BangHead:
My code is that below, and i 've added internet permissions.

B4X:
public class MainActivity extends Activity 
{
    WebView webobj;
    static String str="http://google.com/";

    @Override
    public void onCreate(Bundle savedInstanceState) 
      {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.web);
        webobj=(WebView)findViewById(R.id.myWebView);
        webobj.getSettings().setJavaScriptEnabled(true);
        webobj.loadUrl(str); 
     }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

Also when trying to use openStream() or openConnection methods of URL class my app crashes.

Any suggestions?
 
Last edited:
Top