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

  • Home
  • SEARCH
  • 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 8426205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:28:59+00:00 2026-06-10T04:28:59+00:00

Calling Specific Method from ListActivity which invokes method in one of the Parent(TabActivity) w/o

  • 0

Calling Specific Method from ListActivity which invokes method in one of the Parent(TabActivity) w/o Losing TabHost Layout

I have Two Activity Inside TabHost
1.PlayingActivity
2.AlbumActivity

By Clicking Button inside AlbumActivty will jump to LIstActivity
->By clicking Item in ListActivity, I want to jump back to one of the method inside-PlayingActivity w/o Losing Tab Layout.

I can accomplish task by calling Activity n specific Method using these

ListActivity clicking on Item invokes specific Method in PlayingActivity

Class SongList extends ListActivty
{
  public void onCreate(Bundle savedInstanceState)
   {
     //implemented list adapter-ls
      listadapter. . . .

      ls.setOnItemClickListener(New View.onItemClickListener)
        {
         public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) 
             {
                    int songIndex=position; 
        Intent i=new Intent(getApplicationContext(),AlbumActivity.class);
            i.putExtra("methodName", "myMethod");
            i.putExtra("index", songIndex);
            startActivity(i);
              }
        }
    }

}

MainActivity which host PlayingActivity & AblumActivity Under TabHost

public class MainActivity extends TabActivity {

 private static final String NOW_PLAYING = "Playing";
    private static final String ALBUM = "Album";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TabHost tabHost = getTabHost();

        // Playing Tab
        TabSpec PlayingSpec = tabHost.newTabSpec(NOW_PLAYING);
        // Tab Icon
        PlayingSpec.setIndicator(NOW_PLAYING, getResources().getDrawable(R.drawable.icon_now_playing));
       Intent PlayingIntent = new Intent(this, PlayingActivity.class);
        // Tab Content
        PlayingSpec.setContent(PlayingIntent);

        // Album Tab
        TabSpec AlbumSpec = tabHost.newTabSpec(ALBUM);
        AlbumSpec.setIndicator(ALBUM, getResources().getDrawable(R.drawable.icon_music));
        Intent AlbumIntent = new Intent(this, AlbumActivity.class);
        AlbumSpec.setContent(AlbumIntent);


        // Adding all TabSpec to TabHost
        tabHost.addTab(PlayingSpec); // Adding Playing tab
        tabHost.addTab(AlbumSpec); // Adding Album tab
}

}

In PlayingActivity called specific method(playSong())

class PlayingActivity extends Activity
{
   public void onCreate(Bundle savedInstanceState)
   {
    }
   protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   String index=intent.getStringExtra("index");
   if(intent.getStringExtra("methodName").equals("myMethod")){
      playSong(Integer.parseInt(index));
   }
}
   private void playSong(int i)
   { 
   }
} 

Now the Catch iz I can somehow invokes specific Method in PlayingActivity but Playing Activity which is under TabHost loses it’s TabLayout

Is there AnyWay we can save Playing Activity to lose from it’s TabLayout??

  • 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-10T04:29:01+00:00Added an answer on June 10, 2026 at 4:29 am

    Just Found out that. Little bit of logic have saved my time.

    Adding

    finish();
    

    inside the activity would done all my work.

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

Sidebar

Related Questions

I am having trouble calling a specific method from another class in my app.
So I have a method I wrote that will copy the selectedValue from one
Calling the WriteObject Method from a background thread is not possible! Is there a
I want to create a specific generic method in Scala. It takes two parameters.
I am calling a Page Method from JQuery as described here: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ This is
I am calling a specific WebMethod from client side like this: function openSmallPopup(int) {
Hallo, I have following jquery code for calling ASP.NET MVC controller method that is
I'd like to make a delegate that invokes a specific instance method, unfortunately, it
I have a method on one of my objects that returns a new instance
Well I'm currently calling a method that requires one char input method, but 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.