File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Not able to run WebView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Not able to run WebView" Watch "Not able to run WebView" New topic
Author

Not able to run WebView

nimish kumar
Ranch Hand

Joined: Dec 04, 2009
Posts: 56
Hi,
I am trying Webview tutorial, but not able to get the output. I get the output using programmatic approach, but with XML layout approach, get error ' prcess com.examples.webview has stopped running unexpectedly" <Force Closure>.

I am using Android 2.2 platform.
Please help. My java source looks like -
package com.examples.webview;

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

public class WebApp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView wv = (WebView)findViewById(R.id.webview);
//WebView wv = new WebView(this);
setContentView(R.layout.main);
//setContentView(wv);
wv.loadUrl("http://www.google.com");
//WebSettings webSet = wv.getSettings();
//webSet.setJavaScriptEnabled(true);

}
}

main.xml is -

<?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"

>
</WebView>


And manifest file is -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examples.webview"
android:versionCode="1"
android:versionName="1.0">

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

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".WebApp"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

IBM-IBM WebSphere Application Server Network Deployment V7.0, Core Administration.
nimish kumar
Ranch Hand

Joined: Dec 04, 2009
Posts: 56
Also, in eclipse error console getting this error -

No command output when running: 'am start -n com.examples.webview/com.examples.webview.WebApp -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' on device emulator-5554

Exception stack trace shows -
com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)
at com.android.ddmlib.Device.executeShellCommand(Device.java:276)
at com.android.ide.eclipse.adt.internal.launch.ActivityLaunchAction.doLaunchAction(ActivityLaunchAction.java:74)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launchApp(AndroidLaunchController.java:1146)
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.clientChanged(AndroidLaunchController.java:1489)
at com.android.ddmlib.AndroidDebugBridge.clientChanged(AndroidDebugBridge.java:868)
at com.android.ddmlib.Device.update(Device.java:398)
at com.android.ddmlib.Client.update(Client.java:835)
at com.android.ddmlib.HandleAppName.handleAPNM(HandleAppName.java:90)
at com.android.ddmlib.HandleAppName.handleChunk(HandleAppName.java:64)
at com.android.ddmlib.MonitorThread.callHandler(MonitorThread.java:414)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:322)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)


What could be the reason?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to run WebView
 
Similar Threads
shows me blank with blinking arrow
How to pass POJOs / data / values between activities?
Unable to obtain bluetooth adapter
android.os.networkonmainthreadexception
How to Start New Activity