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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:48:54+00:00 2026-06-13T01:48:54+00:00

I have got the same problem for 8 days now and i hope that

  • 0

I have got the same problem for 8 days now and i hope that someone can help me, i am working on an application that parse multiple RSS feeds and display them on listview with fragment but the problem is that the UI get blocked for 2 to 4 seconds, and every time the user touches the screen the application crashes.
I tracked the problem and i found out that i had to bring the data asynchronously, which i actually did, but every time i have a fragment, the same problem occurs.
In fact,the fragment blocks when it brings data if it does it from a main thread, while i actually bring data asynchronously, that’s why i can’t get the reason for the blocking.

This is how i change my code, this is my interface

public interface OnTaskFinishedListener {
void onTaskFinished(ArrayList<Article> articles);
}

i am getting the ArrayList in the AsyncTask like this

public class AndroidSaxFeedParserAsync extends AsyncTask<String, Long,ArrayList<Article>> {
ArrayList<Article> rssItems = new ArrayList<Article>();

public URL feedUrl;

OnTaskFinishedListener onTaskFinishedListener;

public AndroidSaxFeedParserAsync(OnTaskFinishedListener _onTaskFinishedListener)
{
    onTaskFinishedListener = _onTaskFinishedListener ;
    }

@Override
protected void onPostExecute(ArrayList<Article> result) {
    super.onPostExecute(result);
    onTaskFinishedListener.onTaskFinished(result);
}
@Override
protected ArrayList<Article> doInBackground(String... params) {
//....
    return rssItems;
}   

}

and finally i get it here in my fragment like this

public class FeedPlayerIndexFragment extends SherlockFragment implements OnTaskFinishedListener{

String url="http://www.whatever.com/index.php?format=feed&amp;type=rss";
ArrayList<Article> feeds;
ItemAdapterArticle lfa;

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    new AndroidSaxFeedParserAsync(new OnTaskFinishedListener() {
        @Override
        public void onTaskFinished(ArrayList<Article> articles) {
        }
    }).execute(url);
    View view=inflater.inflate(R.layout.main, container, false);
//....
return view;
}

@Override
public void onTaskFinished(ArrayList<Article> articles) {
    lfa = new ItemAdapterArticle(getActivity().getApplicationContext(), articles);  
    }

}

  • 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-13T01:48:56+00:00Added an answer on June 13, 2026 at 1:48 am

    Problem is that you’re using AsyncTask.get() call which is actually blocking. There’s another solution on this problem which doesn’t block the UI thread. You need to define a simple interface:

    public interface OnTaskFinishedListener {
        void onTaskFinished(List<Article> articles);
    }
    

    The calling Fragment should implement this interface. When instantiating the AsyncTask you send your Fragment as an OnTaskFinishedListener instance as a parameter to constructor. The AsyncTask should hold the reference to OnTaskFinishedListener instance, and when the work is done, in onPostExecute(), you call onTaskFinished() on the instance. Now, in the Fragment you can respond to this call and use the articles parameter to populate your UI components. Hope this helps.

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

Sidebar

Related Questions

vb.net windows forms question. I've got 3 forms that have exactly the same functions,
How to change - in url. I have got the same problem with space
I've got a problem with my previous question. Nobody can't help me so I'll
I've got two long lists A and B which have the same length but
Basically, I have the same question as this one , which unfortunately never got
I have got the requirement to find the core file in multiple box/machine and
Got a problem here and i've been pulling my hair last few days... I'm
I have Uploade the App on android market few days ago. Now i have
For 2 days i have been stucked at transaction problem in my Django project.
Background I have been using ANTLRWorks (V 1.4.3) for a few days now and

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.