views:

60

answers:

1

I want to launch an Activity with a webView as its content from current Activity. This new activity needs to be transparent and webview should be in the center. I looked around the web but only solutions I found were using style xmls. I want to do it using pure code i.e. no xml declarations. if anybody has come across this then please shed some light.

A: 

Have you considered creating a Dialog with a WebView embedded in it?

EDIT Here is what I have in my onCreateDialog() :

Dialog d = new Dialog(MainFloatOver.this);
LinearLayout mLinearLayout = new LinearLayout(this);
mLinearLayout.setBackgroundColor(android.R.color.transparent);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
mLinearLayout.setLayoutParams(llp);
d.setContentView(mLinearLayout);
WebView mWebView = new WebView(this);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("www.google.com");
mLinearLayout.addView(mWebView);
Sephy
yaa, I tried that but as soon as I load a URL in the webview, it gets opened in the browser instead of the webview inside the dialog.
bhups
that's weird, I used this technic a few weeks ago and it was working... Though I was getting a "Web Page not available" every time I tried to use an external link...
Sephy
can you show me the code that you are using. For "Web Page no available" you might need to add internet permission to your app.
bhups
I have the internet permissino, enabled javascript, tried to change the WebClient... don't know why I get that... I'll give you the code in an hour when I have it
Sephy