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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:01:50+00:00 2026-06-15T17:01:50+00:00

I have one activity which forms the basis of my application. Here is the

  • 0

I have one activity which forms the basis of my application. Here is the problem.

  • I create an activity instance called Instance1.
  • My activity is then sent to the background by navigating back to the home menu. onPause and onStop are called on Instance1.
  • I then navigate to Gmail and open an emails attachment.
  • This creates a new instance of my activity ‘Instance2` (I know this because I log what the instance is). Anything I do now within my activity is within this new instance.
  • If I then navigate out and to gmail, onDestroy is called on Instance2 then if I open my application by touching the icon the original Instance1 onRestart is called.

Here is my intent filter inside my manifest.xml

<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.dog" />
</intent-filter>

I have also added the following to my Applications tag in the manifest file but it has no effect.

android:launchMode="singleTask"

Question

Why can’t it realise there is an instance running and open that?

ADDITION

I used singleInstance and moved it into my Activity tag. However, now I can’t get my email attachments data? Previously I used the following.

Intent intent = getIntent();

        if (intent != null) {
            Log.d("MainActivity","Intent not null");
            Uri u = intent.getData();
            if (u != null) {
                Log.d("MainActivity","URI not null");
  • 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-15T17:01:51+00:00Added an answer on June 15, 2026 at 5:01 pm

    The launchMode tag is part of the <activity> element, not the application element.

    You should use singleTop to re-use the existing activity.

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

Sidebar

Related Questions

i have main activity in which i have Four menus. and i have one
I have one class called Global and two other activities. In each activity I
I have one activity in which I am having one TabHost with two tabs.
I am using fragments to show images/pages.I have one Activity(Main) which contains all the
I'm writing my first Android application and I have one activity that I'd like
I have one custom ListView called AreasListView which I've included in the XML file.
I have one activity which download data from the web. In middle of the
I have one Activity in which I try to show some simple messages, and
I have one Activity which displayed some Dialog boxes and Progress bars. This activity
I have one activity which i am using for displaying Dialogs and as a

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.