screen layout without all the tabs, android

Posted on 2013-01-08
Last Modified: 2013-01-15
Here is an small example of  the attached file called  AndroidTabLayoutActvity is the tab related activity.

In the photos-layout i have a text and a button, my idea is when i click on the button with the text value in the  PhotoActivity class it should go to the SongsActivity class with the value getting displayed as Textview with the tab. so i have used intent API to send the value from the PhotoActivity class to the SongsActivity class, it is getting displayed but not with the tabs like photo, songs and video tabs, but with the SongsActvity screen layout only.
Question by:roy_sanu
  • 4
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38754301
What is the minimum API level are you targeting?

Author Comment

ID: 38754312
I am using Android 2.2

Assisted Solution

Santhana earned 500 total points
ID: 38754343

Instead of firing the intent to launch the "SongsActivity" you can maintain a common data structure to store the selected data or text from the "PhotoActivity ". While clicking on the button in the "PhotoActivity " you can set the current tab as the "SongsActivity" tab by using the following code ..

TabActivity parent = (TabActivity) getParent();
TabHost tabhost = parent.getTabHost();
tabhost.setCurrentTab(1);  // If the song tab is added as second tab

While showing the "SongsActivity" you should get the data from the same data structure.

For more you can refer this link

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Accepted Solution

roy_sanu earned 0 total points
ID: 38754452

Here is the  code inside the  "PhotoActivity" , i tried it, it  shows the  value with tab  for some flash of second with "songActivity" , again it goes back single screen such as songActivity layout screen.

public class ButtonClickHandler implements View.OnClickListener {
            public void onClick(View view) {
                  if (nameEditCtrl != null && nameEditCtrl.getText().length() != 0) {
                        name = nameEditCtrl.getText().toString();
                  } else {
                        name = "Guest";

      Intent intObj = new Intent(PhotosActivity.this,
            intObj.putExtra("USERNAME", name);
                  AndroidTabLayoutActivity parent = (AndroidTabLayoutActivity) getParent();
                  TabHost tabhost = parent.getTabHost();

Assisted Solution

roy_sanu earned 0 total points
ID: 38765873
it works  in  PhotoActivity class as
           getParent().getIntent().putExtra("key", name);
            TabActivity parent = (TabActivity) getParent();
            TabHost tabhost = parent.getTabHost();

it works with songActvity class if it has

 String valueString=getParent().getIntent().getStringExtra("key");
    greetMsg1.setText("Welcome " + valueString);

Author Closing Comment

ID: 38777621
The question i asked was not answered half, other part was done by me

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of Part-1 as evident from the title. Please visit this page ( to read the earlier Part -1. If y…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to:…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question