PDA

View Full Version : help with my web view app



cyberpedz
01-16-2011, 06:52 AM
I have a web view app which I put together from tutorials around the net. If I am honest I don't really understand the code at all and have hit a wall. I need to add a few features but just don't have a clue would be great if someone could have a look at my code and maybe add the features for me or explain what code to put where. I would like to add a soft menu with a refresh, forward, back, home and forum button. I also need to fix the isssue when hitting the hard back button which exits the app instead I need to make it go back to last page. It would be really great if someone can help. Most direct me to Dev tutorials from google but I don't really understand the code.

If you are willing to help please let me know.

My code:

main.xml



<?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"
android:scrollbars="none"
/>


Manifest


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.windowcleaningforums"
android:versionCode="2"
android:versionName="1.0.1">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".windowcleaningforums"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>


Java


package com.windowcleaningforums;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class windowcleaningforums extends Activity
{
final Activity activity = this;

@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PRO GRESS);
setContentView(R.layout.main);

WebView webView = (WebView) findViewById(R.id.WebView);
webView.getSettings().setJavaScriptEnabled(true);

webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle(" Loading...");
activity.setProgress(progress * 100);

if(progress == 100)
activity.setTitle(R.string.app_name);
}
});

webView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
// Handle the error
}

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});

webView.loadUrl("http://www.windowcleaningforums.co.uk");
}
}

cyberpedz
01-16-2011, 12:26 PM
Why do i get ignored?

I have posted on many many android forums asking for help bu nobody replies, is it the way i ask or are developers really that closed and arrogant hat they do not want to share there knowledge.

Vimes
01-16-2011, 02:42 PM
There are several other forums that are more closely focused on development.

Try these:

http://www.anddev.org/

http://www.coderanch.com/forums/f-93/Android

http://stackoverflow.com/

cyberpedz
01-16-2011, 02:50 PM
Ye I have posted on most of them it seems most developers don't want to help or don't want you o have an app. Shame really.

prkrshawn
01-20-2011, 04:50 AM
This is really informative information that you provide over here. I really like this thread very much. This is nice as well as informative thread. I also follow the links that you provide here. It is also very nice and meaningful for me.