Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:54:02+00:00 2026-06-09T12:54:02+00:00

I am making an application in which i am giving an add.But even when

  • 0

I am making an application in which i am giving an add.But even when the internet connection not available,it takes space in the view/layout.I just want to hide it and to not allow it taking space in layout/view when the internet is not available.This is the xml :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_centerHorizontal="true"
    android:orientation="vertical" >

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:visibility="visible" >

            <ImageView
                android:id="@+id/explain_QuestionImageView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="visible" />

            <ScrollView
                android:id="@+id/scrollView1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5.0dip"
                android:layout_marginLeft="1.0dip"
                android:layout_marginRight="1.0dip"
                android:layout_marginTop="1.0dip"
                android:fadeScrollbars="true"
                android:fadingEdge="none"
                android:fillViewport="true" >

                <TextView
                    android:id="@+id/explain_question"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_below="@id/explain_QuestionImageView"
                    android:fadingEdge="vertical"
                    android:scrollbars="vertical"
                    android:text=""
                    android:textColor="@color/question_text"
                    android:textColorHighlight="@color/question_text1" />
            </ScrollView>

            <TextView
                android:id="@+id/explain_separator"
                android:layout_width="match_parent"
                android:layout_height="5.0dip"
                android:layout_alignParentRight="true"
                android:layout_below="@id/explain_question"
                android:background="@drawable/blue_gradient"
                android:fadingEdge="vertical"
                android:padding="10dp"
                android:scrollbars="vertical"
                android:text="" />

            <ScrollView
                android:id="@+id/scrollView2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="100.0dip"
                android:layout_marginLeft="1.0dip"
                android:layout_marginRight="1.0dip"
                android:layout_marginTop="1.0dip"
                android:fadeScrollbars="true"
                android:fadingEdge="none"
                android:fillViewport="true" >

                <TextView
                    android:id="@+id/explain_explaination"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_below="@id/explain_separator"
                    android:fadingEdge="vertical"
                    android:padding="10dp"
                    android:scrollbars="vertical"
                    android:text=""
                    android:textColor="@color/dark_green" />
            </ScrollView>
        </LinearLayout>
        <!-- </ScrollView> -->

    </FrameLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
       >

        <com.google.ads.AdView
            android:id="@+id/ad"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:keepScreenOn="true"
            ads:adSize="BANNER"
            ads:adUnitId="a1501e5633125fb"
            ads:loadAdOnCreate="true"
            ads:testDevices="TEST_EMULATOR, 123456789ABCDEF" >
        </com.google.ads.AdView>

        <LinearLayout
            android:id="@+id/LL_Buttons1"
            android:layout_width="fill_parent"
            android:layout_height="40.0dip"
            android:layout_above="@id/ad"
            android:layout_gravity="bottom"
            android:background="#ff777777"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/PrevExplainationButton"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_centerInParent="true"
                android:layout_marginLeft="2.0dip"
                android:layout_weight="1.0"
                android:background="@drawable/ibtn"
                android:onClick="onPrevExplainationButtonClick"
                android:text="Previous" />

            <Button
                android:id="@+id/NextExplainationButton"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_centerInParent="true"
                android:layout_marginLeft="5.0dip"
                android:layout_marginRight="2.0dp"
                android:layout_weight="1.0"
                android:background="@drawable/ibtn"
                android:onClick="onNextExplainationButtonClick"
                android:text="Next" />
        </LinearLayout>
    </RelativeLayout>

please tell me how to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:54:03+00:00Added an answer on June 9, 2026 at 12:54 pm

    Here, to put a more concrete example you can test for connection and then setting the visibility to gone:

    private boolean isNetworkConnected() {
        yourAddView = (AdView) findViewById(R.id.ad);
        ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        if (ni == null) {
          // There are no active networks.
          //Set the visibility to "gone".
          //You can set visibility to gone here or when the function returns,
          //that is why there is a return false and true. 
          myView.setVisibility(8);
          return false;
        } else
        return true;
    }
    

    Also you need to add these permissions to the manifest file:

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an application which requires me to list all the images available
i m making an application which shows data on table view with many fields
I am making an application which takes image from the camera and then email
I am making a application which will show data in table view. I am
I am making an application in which i want to post videos on facebook.But
I am making an application which Streams media from the Internet,it can be from
i am making an application in which am creating 5 tabbars in iDocViewController view.
I am making an application which makes use of the internet. It works fine
I am making an application which is almost done but there is one thing
I am making an email application which is giving the error in this question's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.