WebView display nothing with TabHost

by elephantbug » Fri, 12 Sep 2008 06:51:05 GMT


Sponsored Links
 i,

The WebView shows nothing the very first time, however, if you switch
to other TAB and return back, everything is displayed.

Here is my XML file:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">

<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TabWidget
android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="450px"
android:paddingTop="60px">

<LinearLayout
android:id="@+id/legal_layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="400px">

<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="350px"
android:background="@drawable/silver">
>
<WebView
android:id="@+id/legal_view"
android:layout_width="fill_parent"
android:layout_height="350px"
android:minHeight="350dp"
android:textColor="@drawable/dark"
android:padding = "3dip"
android:paddingLeft = "3dip"
android:paddingRight = "3dip"
android:paddingTop = "3dip"
android:paddingBottom = "3dip"
android:text="test"/>
</ScrollView>

<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop = "3dip"
android:gravity="center">

<Button
android:id = "@+id/button_accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_accept_text"/>

<Button
android:id = &



WebView display nothing with TabHost

by Mark Murphy » Fri, 12 Sep 2008 07:19:19 GMT


 


Don't put WebView in a ScrollView. It does its own scrolling.

I don't know if that is your problem, but it is worth a try.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Warescription: All titles, revisions, & ebook formats, just $35/year

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


WebView display nothing with TabHost

by elephantbug » Fri, 12 Sep 2008 10:12:15 GMT


 Mark,

I tried that. The problem still persists...

I even tried to some simple Html in onCreate method... nothing
displayed at all..






--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by dai » Fri, 12 Sep 2008 10:28:57 GMT


 elephantbug, what kind of web page are you trying to display? Perhaps
 http://www.google.com ?

If you do try to show web pages using javascript like...above page,
you have to set-on javascript.

/** enabling js manually */
webView.getSettings().setJavaScriptEnabled(true);

hope this helps






--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by Megha Joshi » Fri, 12 Sep 2008 11:57:33 GMT


 008/9/11 elephantbug <[EMAIL PROTECTED]>



If loadAllLegalText() is something that puts data into TOC below, is it a
blocking call? You may want to check if TOC actually contains data when you
call loadData()..


--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by elephantbug » Sat, 13 Sep 2008 02:23:06 GMT


 i,

The LoadAllLegalText is not a blocking call or different thread. The
TOC has been initialized when it is loaded.

I tried following code even:
legalText = (WebView)findViewById(R.id.legal_view);
legalText.loadData("<html><body>boo</body></html>", mimeType,
encoding);

Still nothing displayed..


On Sep 11, 8:56pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:

--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by Megha Joshi » Sat, 13 Sep 2008 06:07:22 GMT


 t seems like you won't get the proper hook into the WebView for changing
its contents on load, if you load tab's content by id.
I was able to make this work using TabContentFactory. For sample code see
the ApiDemos/Views/Tabs sample.
On subsequent tab clicks you could change the content dynamically using
OnTabChangeListener.

2008/9/12 elephantbug <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~



WebView display nothing with TabHost

by elephantbug » Sat, 13 Sep 2008 15:55:28 GMT


 i, Megha,

It works!!!...

Thanks so much.

--elephantbug

On Sep 12, 3:07pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Add Media Files to Library in Froyo

I have develop and app that downloads music files and should add them
to the music library.  I use the following class to do this:

public class MediaScannerNotifier implements
MediaScannerConnectionClient {

        private Context mContext;
        private MediaScannerConnection mConnection;
        private String mPath;
        private String mMimeType;

        public MediaScannerNotifier(Context context, String path, String
mimeType) {
                mContext = context;
                mPath = path;
                mMimeType = mimeType;
                mConnection = new MediaScannerConnection(context, this);
                mConnection.connect();
        }

        public void onMediaScannerConnected() {
                Log.e("SCANNER","SCAN CONNECTED");
                mConnection.scanFile(mPath, mMimeType);
        }

        public void onScanCompleted(String path, Uri uri) {
                Log.e("SCANNER","SCAN COMPLETED "+path+" "+uri);
                mConnection.disconnect();
                mContext = null;
        }
}

Everything works ok with android 2.1 and below.  But, in android 2.2,
the media files do not get added to my music library. :(  I know there
were some changes in froyo API for music scanning, but I am unsure why
the above no longer works.

By the way, everything seems to scan fine - i.e. I get ok log messages
- E/SCANNER (  339): SCAN COMPLETED /sdcard/EMusic/Josh Woodward/
Breadcrumbs/TheVoices.mp3 content://media/internal/audio/media/4

Any idea on what to change to make media scanning work again in froyo?

-- 

2. Can I make a Dialog invisible?

Hi, I have a parent dialog calling a child dialog. Can I make the
parent dialog invisible to it is more appealing to the eye?
Is there something like setVisibility(View.INVISIBLE) for dialog?

Many thanks.

-- 

3. Cookies in the Android browse

4. Authenticatio

5. Software Patchin

6. How to add entry into sdp record

7. deleting object from a different thread