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:
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="View Helpcast"
/>
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);
}
254
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
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:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="0px"
android:layout_weight="1"
/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="View Helpcast"
/>
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);
}
254
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
