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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:58:10+00:00 2026-06-18T01:58:10+00:00

Im trying to place a button but I dont know why Eclipse keeps throwing

  • 0

Im trying to place a button but I dont know why Eclipse keeps throwing me this error “The local variable button may have not been initialized”. I added a button in the xml file “rssfeedadapter_layout”. But I cant call it in the code. Im trying this:

RssReaderListAdapter.java

package com.rssfeed.adapter;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import com.rssfeed.R;
import com.rssfeed.helper.RssFeedStructure;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

public class RssReaderListAdapter extends ArrayAdapter<RssFeedStructure> {

List<RssFeedStructure> imageAndTexts1 =null;
public RssReaderListAdapter(Activity activity, List<RssFeedStructure> imageAndTexts) {
super(activity, 0, imageAndTexts);
imageAndTexts1 = imageAndTexts;

}


@Override
public View getView(int position, View convertView, ViewGroup parent) {

Activity activity = (Activity) getContext();
LayoutInflater inflater = activity.getLayoutInflater();


View rowView = inflater.inflate(R.layout.rssfeedadapter_layout, null);
TextView title = (TextView) rowView.findViewById(R.id.feed_text);
TextView description = (TextView) rowView.findViewById(R.id.feed_updatetime);
ImageButton button = (ImageButton) button.findViewById(R.id.button_web);//Eclipse keeps throwing error in this line
ImageView imageView = (ImageView) rowView.findViewById(R.id.feed_image);
ImageLoader imgLoader;
imgLoader = new ImageLoader(activity);
        Log.d("rssfeed", "imageAndTexts1.get(position).getImgLink() :: " +imageAndTexts1.get(position).getImgLink() +" :: " +imageAndTexts1.get(position).getTitle());
        title.setText(imageAndTexts1.get(position).getTitle());
        description.setText(imageAndTexts1.get(position).getDescription());
        if(imageAndTexts1.get(position).getImgLink() !=null){

            String imageUrl= imageAndTexts1.get(position).getImgLink();
            imgLoader.DisplayImage(imageUrl, imageView);

            }

return rowView;

}

}
  • 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-18T01:58:11+00:00Added an answer on June 18, 2026 at 1:58 am

    use

    ImageButton button = (ImageButton) rowView.findViewById(R.id.button_web);
    

    instead of

    ImageButton button = (ImageButton) button.findViewById(R.id.button_web);
    

    you need to use rowView to get initialize button from rssfeedadapter_layout layout instead of button

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

Sidebar

Related Questions

I'm trying to place a button. I have its position set to absolute, so
I really don't know how to express this question. But what I'm trying to
I am trying to put a JavaFX button in a specific place (specific coordinates)
I'm trying to place a flash video (object, swf) inside a div, and have
I am trying to place a value (from an object) in a variable and
I am trying to place a button in the TabWidget, meaning that I want
I am trying to place two canvas nearby. But unfortunately when i include two
hi there I have this code but for some reason the message its showing
I know that ASP.NET controls such as the button have the postback event model.
Sorry if this question sounds stupid, but I only know HTML/CSS and so I'm

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.