small medium large xlarge

Generic-user-small
20 Oct 2012, 10:46
Roger Wolfendale (2 posts)

Hi and hope someone can help. I thought that I was doing quite well as I’d progressed all through the Sudoku tutorial with only flesh wounds but I can’t get the BrowserIntent and BrowserView tutorials to work.

Both seem to fail in about same place, the final line of code just before the last 2 curly brackets with an error message, “urlText cannot be resolved.”

Any clues? My thanks.

`
package com.example.browserview2;

import android.os.Bundle;
import android.webkit.WebView;
import android.app.Activity;
import android.view.Menu;

public class BrowserView extends Activity {
	private WebView webView;

	// ...

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		webView = (WebView) findViewById(R.id.web_view);
		// ...
	}

	/** Open a browser on the URL specified in the text box */
	private void openBrowser() {
		webView.getSettings().setJavaScriptEnabled(true);
		webView.loadUrl(urlText.getText().toString()); // FAILS ON THIS LINE
	}
}
`
Generic-user-small
22 Oct 2012, 07:39
Anthony Shaw (138 posts)

Looks like you have missed a lot of stuff from page 124, in particular the ‘private EditText urlText;’. There are lots of other things missing as well so check you code against the listing and hopefully you will get going again

Generic-user-small
23 Oct 2012, 13:37
Roger Wolfendale (2 posts)

Thanks Anthony,

A couple of points… 1) I think you mean page 134 not 124, no big deal! 2) The tutorial at 7.2 tells me to start a new project, your suggestion implies using the Browser Intent project at 7.1 as the starting point for the project. 3) However, your basic idea works in that some of the code from Section 7.1 shoud be added into the new project in 7.2.

So in summary, many thanks though I believe that this should be flagged up as some sort of errata.

Best wishes and thanks.

Generic-user-small
24 Oct 2012, 13:03
Anthony Shaw (138 posts)

Glad it got you going, lots more fun when the programs actually run.

Burnette_ed_pragsmall
13 Apr 2013, 21:14
Ed Burnette (1330 posts)

Instead of starting with a blank project it should have said copy the last project, or at least copy parts of it. I see you entered an erratum, thanks.

  You must be logged in to comment