I've narrowed down the problem to WebView; my application force closes every time. If I take out the WebView and put in a color change button or something, the case switching works and the application loads. I'm fairly new to the plaform, but I'm (mostly) copying directly from examples here for WebViews.
Application.java
package com.xxxx.xxxxx;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
public class Application extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
}
public void myClickHandler(View view) {
WebView engine = (WebView) findViewById(R.id.webview);
switch (view.getId()) {
case R.id.Button1:
engine.loadUrl("http://digg.com");
break;
case R.id.Button2:
engine.loadUrl("http://reddit.com");
break;
}
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/ScrollParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/MainMenuLayout"
android:layout_width="310px"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/Application"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Application Name..." />
<Button android:id="@+id/Button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Digg"
android:onClick="myClickHandler"/>
<Button android:id="@+id/Button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Reddit"
android:onClick="myClickHandler"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</ScrollView>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.qxmd.ecgguide"
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=".Application"
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>