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 7069051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:55+00:00 2026-05-28T05:23:55+00:00

I am doing lazyloading to display images and text. I have got everything up

  • 0

I am doing lazyloading to display images and text. I have got everything up and now, trying to add a textview in the view. However, my adapter is overlapping my view. Simpler terms is that, the listview is overlapping the textview. I’m not sure where I’m doing it wrong because the original example is able to display a button just below the listview but I’m not. I’m not getting any errors. My listview just covers the whole screen. Any idea what might be the problem?

main.java

public class main extends Activity {

private static final String targetURL ="http://www.google.com/images";
ListView list;

ProgressDialog dialog;
private String[] mStrings = {};
private String[] dStrings = {};
//TextView tv;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);         
    new TheTask().execute();
    list=(ListView)findViewById(R.id.list);
    TextView tv = (TextView)findViewById(R.id.tv);

    //tv.setText("Text View is displayed");
}   


protected class TheTask extends AsyncTask<Void, Void, MyResultClass >{

    protected void onPreExecute() {
        dialog = ProgressDialog.show(Cats.this, "Retrieving Information", "Please wait for few seconds...", true, false);
        dialog.setCancelable(true);
    }

    protected MyResultClass doInBackground(Void... params) {
        searchContent();
        MyResultClass result = new MyResultClass();
        result.mStrings = mStrings;
        result.dStrings = dStrings;
        return result;
    }   

    protected void onPostExecute(MyResultClass result) {            
        dStrings = result.dStrings;
        mStrings = result.mStrings;         
        LazyAdapter adapter = new LazyAdapter(Cats.this, mStrings, dStrings);
        list.setAdapter(adapter);
        dialog.dismiss();
    }       
}

    class MyResultClass
    { 
        public String[] mStrings; 
        public String[] dStrings; 
    }

public void searchContent()
{
    String imageC = "";
    String textC = "";

    try {

        URL url = new URL(targetURL);

        // Make the connection
        URLConnection conn = url.openConnection();
        BufferedReader reader = new BufferedReader(
         new InputStreamReader(conn.getInputStream()));

        String line = reader.readLine();
        Pattern sChar = Pattern.compile("&.*?;");
        line.replaceAll("\\<.*?\\>", "");
        Matcher msChar = sChar.matcher(line);
        while (msChar.find()) line = msChar.replaceAll("");

        while (line != null) {

            if(line.contains("../../"))
            {

                int startIndex = line.indexOf("../../") + 6;
                int endIndex = line.indexOf(">", startIndex + 1);
                String abc = "http://www.google.com/";
                String imageSrc = line.substring(startIndex,endIndex);
                //complete full url
                String xyz = abc +imageSrc;
                xyz = xyz.substring(0,xyz.indexOf('"'));
                xyz = xyz +";";
                xyz = xyz.replaceAll(" ", "%20");
                imageC += xyz;                  
                mStrings = imageC.split(";");
                line = reader.readLine();
            }

            if(line.contains("../../") == false)
            {
                line = reader.readLine();
            }

            if (line.contains("Gnametag"))
            {
                int startIndex = line.indexOf("Gnametag") + 10;
                int endIndex = line.indexOf("<", startIndex + 1);
                String gname = line.substring(startIndex,endIndex);
                textC = textC.replaceAll("</span>", "");
                textC += "Name: "+gname+ "\n";
            }

                if (line.contains("Age"))
                {
                    textC += "Age: "+reader.readLine() + "\n" + ";";
                    textC = textC.replaceAll("                  ", "");
                    dStrings = textC.split(";");
                }

            if (line.contains("Last Update"))
            {
                reader.close();
            }                               
        }           

        // Close the reader
        reader.close();

    } catch (Exception ex) {
        ex.printStackTrace();           
    }     

}
}

Adapter.java

public View getView(int position, View convertView, ViewGroup parent) {
    View vi=convertView;
    ViewHolder holder;
    if(convertView==null){
        vi = inflater.inflate(R.layout.item, null);
        holder=new ViewHolder();
        holder.text=(TextView)vi.findViewById(R.id.text);;
        holder.image=(ImageView)vi.findViewById(R.id.image);
        vi.setTag(holder);
    }
    else
        holder=(ViewHolder)vi.getTag();

    holder.text.setText(text[position]);
    holder.image.setTag(data[position]);
    imageLoader.DisplayImage(data[position], activity, holder.image);
    return vi;
}

item.xml (used by Adapter.java)

<?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="wrap_content"
android:background="#FFFFFF">
<ImageView
  android:id="@+id/image"
  android:layout_width="90dip"
  android:layout_height="90dip" 
  android:src="@drawable/stub" 
  android:scaleType="centerCrop"
  android:layout_gravity="left|center_vertical" 
  />

<TextView
  android:id="@+id/text"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:gravity="center"
  android:textSize="15dip"/>

</LinearLayout>

main.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">

<LinearLayout
android:id="@+id/linear1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF">

<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing 123"
/> 

</LinearLayout>

<LinearLayout
android:id="@+id/linear2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"    
android:layout_below="@+id/linear1"
android:background="#FFFFFF">

<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"/>
</LinearLayout>

</RelativeLayout>
  • 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-05-28T05:23:56+00:00Added an answer on May 28, 2026 at 5:23 am

    Just remove the + symbol from this line

    android:layout_below="@+id/linear1"
    

    in second linear layout stanza.

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

Sidebar

Related Questions

Doing regex in C# or PHP is very easy for me now. However currently
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing my first tryouts with foreign keys in a mySQL database and are trying
Doing some jquery animation. I have certain divs set up with an attribute of
I can't figure out what I am doing wrong. I have the following method:
Short Question: Basically I am trying to add a scalar property to my entity
I have some entity types that I would like to lazy load. However, they
Doing some code reviews lately I came across a number of classes that have
I have a Treeview which is doing lazy loading. I used MVVM. I wanted
I have a view model (below). public class TopicsViewModel { public Topic Topic {

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.