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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:58:11+00:00 2026-05-20T07:58:11+00:00

I have problem with Activities navigation, searching works good. Activities hierarchy looks like that:

  • 0

I have problem with Activities navigation, searching works good.

Activities hierarchy looks like that:

                              /  MyListActivityA -- ItemActivityA
MainActivity -- MyTabActivity -- MyListActivityB -- ItemActivityB
                              \  MyListActivityB -- ItemActivityC

Tabs in TabActivity are created using Intents with MyListActivity.

MyListActivities are declared in manifest like below:

    <activity
        android:name=".views.OrderListView">
        <intent-filter>
            <action
                android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data
            android:name="android.app.searchable"
            android:resource="@xml/searchable_orders" />
    </activity>

Every MyListActivity has own SearchRecentSuggestionsProvider.

First resolved problem

When invoked search on any of MyListActivity I got the activity outside the MyTabActivity. Therefore implemented redirecting to MyTabActivity.
In onCreate() of MyListActivity intent action is checked. If it’s

Intent.ACTION_SEARCH

then start TabActivity and finish current, like below:

    if(Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        intent.setClass(context, MyTabActivity.class);
        intent.setAction(MyTabActivity.ACTION_SEARCH_PROXY);

        Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);

        if(appData != null) {
            intent.putExtras(appData);
        }

        intent.putExtra(Constants.ACTIVITY_TYPE, activityType);
        intent.putExtra(ActivityTabView.EXTRA_SEARCH_QUERY, query);

        context.startActivity(intent);
        context.finish();
    }

When MyListActivity find

ActivityTabView.EXTRA_SEARCH_QUERY

it makes search query on list. And problem resolved.

Second resolved problem

Clicking “Back” button clears search query – that’s ok. But clicking “Back” again shows past searches.

That’s why I put noHistory to MyTabActivity:

<activity
    android:name=".views.MyTabActivity"
    android:noHistory="true">
</activity>

Third UNresolved problem

Now, for example, going from MyListActivityA to ItemActivityA and clicking “Back” redirects to MainActivity. I can’t do back to MyTabActivity because of noHistory parameter.

Is there any good solution for using Android searching in TabActivity for each activity in tab respectively?

  • 1 1 Answer
  • 1 View
  • 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-20T07:58:12+00:00Added an answer on May 20, 2026 at 7:58 am

    I recommend to read Tasks and Back Stack. It gave me better understandings of activities stack in android.

    My solution:

    Invoked Quick Search Dialog starts the activity by which it was invoked, in this example it is MyListActivity. That makes TabActivity dissapear, that’s why there is no visible TabWidget. Therefore in MyListActivity is implemented redirection to MyTabActivity (see First resolved problem). MyTabActivity just redirects extras, with search query, included in intent to specific MyListActivity.

    All you have to do now is add one line. Set FLAG_ACTIVITY_CLEAR_TOP flag on intent that starts MyTabActivity.

    if(Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        intent.setClass(context, MyTabActivity.class);
        intent.setAction(MyTabActivity.ACTION_SEARCH_PROXY);
    
        Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);
    
        if(appData != null) {
            intent.putExtras(appData);
        }
    
        intent.putExtra(Constants.ACTIVITY_TYPE, activityType);
        intent.putExtra(ActivityTabView.EXTRA_SEARCH_QUERY, query);
    
        //added line
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    
        context.startActivity(intent);
        context.finish();
    }
    

    Then normal activities navigation is preserved.

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

Sidebar

Related Questions

I have a problem. I have two refresh button in differents activities that It
I have a problem handling messages in a Thread. My run-method looks like this
that's my first post here. I have problem with managing activities. I have my
I have a problem that one of my activities is popping out after I
I have a problem : My application has several activities ( e.g. StartActivity, MainActivity
I have a problem with my Android app. I have three Activities that all
In my app I have a navigation menu that is constant between activities. To
I have a problem on an Android app. I have 2 activities : Activity1
Problem : I have say 4 activities A, B, C and D. A --
I have a problem using DatagramSocket. The problem is that I can't run two

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.