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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:21:57+00:00 2026-06-01T15:21:57+00:00

I have an IntentService that is parsing some xlm file to create a html

  • 0

I have an IntentService that is parsing some xlm file to create a html file. I am already done with creating that html file with some templates. But the problem is I need to change that html file for every single “media” node that I parsed from my file. And then according that new incoming type I have to create a new corresponding html file to view via a WebView.

So far I tried to create some handlers and pass intent to WebView class. ( I am not sending any data via bundles. I just create that html file in my service class then call that file from WebView.) This think works for the first time. However after first media is over I couldnt call the same activity for the 2nd time.
Code piece for calling WebView is the following:

if(counter == 0){
    createDir(); //function to create html file with corresponding date
    Intent sender = new Intent(getApplicationContext(), webLoader.class);
    //System.out.println("here");
    sender.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(sender);
}
else
{
    //System.out.println("entering?");              
    System.out.println(durationOfMedi);

    new Handler().postDelayed(new Runnable() {

        public void run() {
            // TODO Auto-generated method stub
            try {
                  createDir(); //function to create html file with corresponding date
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Intent sender = new Intent(getApplicationContext(), webLoader.class);
            sender.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(sender);
            }
    }, durationOfMedi*1000);
 }

What I am basically trying to do is, I iterate through each media item and according to their values and etc.. I make another html file within the IntentService and then I try to start my WebView activity in order to view that html file. Each of those media items have some duration to be seen in the screen so that is why I used postDelayed after the first media and I keep its track with some variable “counter”.(With first media I directly create file and show it but after that I wait for some time “durationOfMedi * 1000” miliseconds.) But it didnt work after first media. It just loads that item to screen via html file and then it wont enter new Handler()… method.
If anyone can help me I would appreciate it. I am clueless about it atm.

  • 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-01T15:21:59+00:00Added an answer on June 1, 2026 at 3:21 pm

    I accomplish that situation by directly sleeping the current thread for some certain amount of time which is done like this:

    if(counter == 0){
        Thread.sleep(1000*previousDuration);
        createDir();
        Intent sender = new Intent(getApplicationContext(), webLoader.class);
        sender.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(sender);                                                      
    }
    

    by applying that kinda method i can fire other activity. And in order to avoid too many task on stack, I also include:

    android:noHistory = "true"
    

    in my manifest file. That did the job. I am posting this if anyone comes into such a situation.

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

Sidebar

Related Questions

I have an IntentService that downloads some files. The problem is that I create
I have an IntentService that is making a network call and receiving back some
I have an IntentService that is initially started with the click on a button:
I have an Android IntentService that is behaving strangely. I am sending it an
I have an IntentService that loads up an ArrayList with data from a network
I have this widget that toggles sound on off but instead of that I
I have a repeating alarm set, my problem is that after cancelling it doesn't
In my application I have an IntentService that reads rss feeds. I would like
I have class that extends 'IntentService' - this class occasionally receives data from a
I have successfully used IntentService a few times, but in the current app, I

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.