This exercise is an enhancement of the previous article –> Sound manipulation using MediaPlayer. Read the previous article first to understand this article better.
This is an exercise to practise using WebView to display a HTML file on your Android app. Found this nice suggestion by Mathias Lin at http://stackoverflow.com/questions/3058164/android-scrolling-an-imageview . The main reason I’m using this is because I need to display image that bigger than the screen. Putting the image in a HTML page, and view the HTML page using this WebView widget will automatically invoke the scrollbars. WebView will act as your HTML page display (using WebKit browser).
STEP 1: Prepare the HTML page, and put it in folder assets.
STEP 2: To use this Widget, just add WebView widget in the UI (main.xml);
STEP 3: In order to make this widget works properly, you must add INTERNET uses-permission in A
STEP 4: Define the WebView widget, and load the local HTML file. Use the following codes;
WebView webview = (WebView)findViewById(R.id.webview);
The complete project source is as below… Have fun!