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

The Archive Base Latest Questions

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

I have been trying to use an intent to open a link to a

  • 0

I have been trying to use an intent to open a link to a kml file using the browser. That way when it goes to the link it will download and open the file in Google Maps (or Google Earth). However, when I click on it in the emulator nothing seems to happen. Any ideas?

package shc_BalloonSat.namespace;

import android.content.Intent;
import android.net.Uri;

public class dl_viewKML
{
    void downloadFile()
    {
        String encodedURL = "http://" + "www.wktechnologies.com/shc_android_app/data.kml";

        Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(encodedURL));
        startActivity(webIntent);

    }

    private void startActivity(Intent webIntent)
    {
        // TODO Auto-generated method stub

    }
}

Eclipse doesn’t show up any problems and it doesn’t show up anything in LogCat.

  • 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-28T18:46:25+00:00Added an answer on May 28, 2026 at 6:46 pm

    For the method startActivity() to start your Intent you have to either call it from the class or subclasses(like Activity, FragmentActivity) of Context or get a reference to the context and call it.

    Because your class dl_viewKML isn’t a subclass of Context you have to get a reference to the context. You can do this by adding a constructor with a Context parameter like in this:

    package shc_BalloonSat.namespace;
    
    import android.content.Intent;
    import android.net.Uri;
    
    public class dl_viewKML {
    private Context ctx
    
    public dl_viewKML(Context ctx) {
    this.ctx = ctx;
    }
        void downloadFile()
        {
            String encodedURL = "http://" + "www.wktechnologies.com/shc_android_app/data.kml";
    
            Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(encodedURL));
            ctx.startActivity(webIntent);
    
        }
    
    }
    

    In your Activity where you instantiate the dl_viewKML class you will do something like this:

    dl_viewKML obj = new dl_viewKML(this);
    

    or

    dl_viewKML obj = new dl_viewKML(getApplicationContext());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to use a formula that is used to work out
I have been trying to use Hibernate for a while. I like hibernate that
I have been trying to create a simple application that will let the user
I have been trying to understand what should be the right way in using
I have been trying to use Android's AudioManager.setMicrophoneMute() without much success. That is, it
I have been trying to use the Perl utility/module "prove" as a test harness
I have been trying to use the latest NAnt (0.86 Beta 1) for a
I have been trying to use routes.rb for creating a URL /similar-to-:product (where product
I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in
I have been trying to use/save the boolean value of a checkbox in other

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.