Browsing Some Posts
To get to HelpCast, let us add a Button to the HelpPage layout and wire it up
so, when clicked, the Button launches HelpCast.
First, add a suitable Button to Patchy/res/layout/help.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"
/>
<Button android:id="@+id/helpcast"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="View Helpcast"
/>
</LinearLayout>
Then, add logic to HelpPage to find the Button and set the on-click listener
to an object that will call startActivity() on HelpCast:
package apt.tutorial.two;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
public class HelpPage extends Activity {
private WebView browser;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.help);
browser=(WebView)findViewById(R.id.webkit);
browser.loadUrl("file:///android_asset/help.html");
Button cast=(Button)findViewById(R.id.helpcast);
cast.setOnClickListener(onCast);
}