I’ve got the following method…
public class Image extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
/* Using WebView to display the full-screen image */
WebView full = (WebView)findViewById(R.id.webview);
/* Set up the Zoom controls */
FrameLayout mContentView = (FrameLayout) getWindow().
getDecorView().findViewById(android.R.id.content);
final View zoom = this.full.getZoomControls();
mContentView.addView(zoom, ZOOM_PARAMS);
zoom.setVisibility(View.VISIBLE);
/* Create a new Html that contains the full-screen image */
String html = new String();
html = ("<html><center><img src=\"1276253554007.jpg\"></html>" );
/* Finally, display the content using WebView */
full.loadDataWithBaseURL("file:///sdcard/DCIM/Camera/",
html,
"text/html",
"utf-8",
"");
}
}
R.id.webview refrences…
<?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"
/>
But I’m getting a full cannot be resolved or is not a field compile error, but full is defined as.. WebView full = (WebView)findViewById(R.id.webview); anyone have any idea why this isnt working?
Thanks.
Remove “this.” prefix from the full variable usages.
It looks like you’re trying to access method local variable, while “this.” keyword is intended for accessing member variables.
Here is modified code sample which compiled and runs just fine for me.