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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:56:21+00:00 2026-05-23T03:56:21+00:00

Im trying to create a RSS feed reader for a project that I working

  • 0

Im trying to create a RSS feed reader for a project that I working on. I got it to parse everything correctly into a textview the only problem is that it won’t display the images that I get from the parsed xml file that gets the html description. I get a bunch of blue blocks instead of the images. So I tried using the ImgGetter method that works for the Html.toHtml method that can convert html tags into normal web text for a textview in the android, though I followed some guides and it still only displays the blue blocks instead of the image.

Here is my code:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import project.gate6.rssreader.R;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

public class ShowDetails extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.details);




        TextView detailsTitle = (TextView)findViewById(R.id.detailstitle);
        TextView detailsDescription = (TextView)findViewById(R.id.detailsdescription);
        TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);
        TextView detailsLink = (TextView)findViewById(R.id.detailslink);


        Bundle bundle = this.getIntent().getExtras();



        detailsTitle.setText(bundle.getString("keyTitle"));
        detailsDescription.setText(Html.fromHtml(bundle.getString("keyDescription"),imgGetter,null));
        detailsDescription.setMovementMethod(new ScrollingMovementMethod());
        detailsPubdate.setText(bundle.getString("keyPubdate"));
        detailsLink.setText(bundle.getString("keyLink"));

    }

    static ImageGetter imgGetter = new Html.ImageGetter() {
        @Override
        public Drawable getDrawable(String source) {
            HttpGet get = new HttpGet(source);
            DefaultHttpClient client = new DefaultHttpClient();
            Drawable drawable = null;
            try{
                HttpResponse response = client.execute(get);
                InputStream stream = response.getEntity().getContent();
                FileOutputStream fileout = new FileOutputStream(new File(Environment.getExternalStorageDirectory().getAbsolutePath()));
                int read = stream.read();
                while(read != -1)
                {
                    fileout.write(read);
                    read = stream.read();
                }
                fileout.flush();
                fileout.close();
                drawable = Drawable.createFromPath(Environment.getExternalStorageDirectory().getAbsolutePath());
                drawable.setBounds(0,0,drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

            }
            catch(ClientProtocolException e)
            {
                e.printStackTrace();
            }
            catch(IOException e)
            {
                e.printStackTrace();
            }
            return drawable;
        }
    };

}

I figured out that a webview works better here is what I did to edit my code:

import project.gate6.rssreader.R;
import android.app.Activity;
import android.os.Bundle;

import android.webkit.WebView;
import android.widget.TextView;

public class ShowDetails extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.details);

        final String mimetype = "text/html";
        final String encoding = "UTF-8";


        TextView detailsTitle = (TextView)findViewById(R.id.detailstitle);
        WebView detailsDescription = (WebView)findViewById(R.id.detailsdescription);
        TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);
        TextView detailsLink = (TextView)findViewById(R.id.detailslink);


        Bundle bundle = this.getIntent().getExtras();



        detailsTitle.setText(bundle.getString("keyTitle"));
        detailsDescription.loadDataWithBaseURL("",bundle.getString("keyDescription"), mimetype, encoding, "");
        detailsPubdate.setText(bundle.getString("keyPubdate"));
        detailsLink.setText(bundle.getString("keyLink"));

    }

}
  • 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-23T03:56:22+00:00Added an answer on May 23, 2026 at 3:56 am

    Used a webview instead, which worked perfectly. The solution is under my first post.

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

Sidebar

Related Questions

I am trying to create a rss feed from a web page. I am
I'm trying to create a rss feed in my Kohana app. I did this
I'm trying to create a RSS 2.0 feed in ASP.NET C# with products to
Trying to create an app that does some socket communication (Writing only). I can
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage
Trying to create a grails ant task that has other environments besides prod for
Trying to create a simple plugin that simply connects to an ftp site, looks
Im trying to create LinqDataSource that will represent data from dynamically created String list

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.