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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:56:36+00:00 2026-06-15T09:56:36+00:00

I want to write an app that sits in the ‘Share via’ menu (for

  • 0

I want to write an app that sits in the ‘Share via’ menu (for quickly emailing myself links to things I find on the web or look at in RSS readers) For this I’m declaring my app with an intent.action.SEND intent-filter:

    <activity
        android:name="uk.co.baroquedub.checkit.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
           </intent-filter>
    </activity>

Here’s a skeleton of the MainActivity package

package uk.co.baroquedub.testcheck;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;

import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

// real code here grabs URL from intent then emails it as an asyncTask:
    doSendTask task = new doSendTask();
    task.execute(new String[] { "urlString" });
}

protected void showDialog (String response){
    Toast.makeText(this, response, Toast.LENGTH_SHORT).show();
    finish();
}

private class doSendTask extends AsyncTask<String, Void, String> {
    @Override
    protected String doInBackground(String... urls) {
      String response = "";
      // Real code here sends the email
      // Simulate waiting for the email to be sent:
      try { 
          Thread.sleep(5000);
          response = "Waited";
      }
      catch (InterruptedException ex) {  }

      return response;
    }

    @Override
        protected void onPostExecute(String result) {
            showDialog(result);
    }
}

}

The problem is that my app is opening on top of the browser (a white screen appears with a title bar showing the name of the app) – which is stopping the browser from being accessible until the ‘wait’ is finished (hence defeating the purpose of wrapping my sendEmail functionality within an asyncTask).

See: screencast for demo of problem

See: related question with full code

Can anyone tell me how I can have my app start (from the ‘Share via’ menu) and execute my code but without actually having a ‘View’ (if that’s the right terminology for the blank screen and title bar)?

  • 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-15T09:56:37+00:00Added an answer on June 15, 2026 at 9:56 am
    1. start an activity without any UI
    2. start a service to do your background service in OnCreate
    3. finish the activity as soon as you start service
    4. let the service post notification or Toast about completion.

    If you do want to show a dialog, you could start a separate activity with just the dialog from service, but it is usually intrusive to show dialog.

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

Sidebar

Related Questions

I want to write a app that can be extended via plugins, using Perl
I want to write an app in java that lets two clients talk via
I want to write a small app that sits in my tray and that
I want to write an app that takes in a model filename via cmd
Suppose I want to write an app for Android OS that is not going
I want to write a small Android app with a GUI that should display
I want to write an application that monitors a music player. In my app
I want to write an app that will allow a program like iTunes which
I want to write an App that monitors my paired bluetooth connection in the
I'm across winforms currently but want to write an app that users will have

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.