Solved

screen layout without all the tabs, android

Posted on 2013-01-08
6
429 Views
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.
AndroidTabLayoutActivity.java
PhotosActivity.java
SongsActivity.java
main.xml
photos-layout.xml
songs-layout.xml
0
Comment
Question by:roy_sanu
  • 4
6 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
What is the minimum API level are you targeting?
0
 

Author Comment

by:roy_sanu
Comment Utility
I am using Android 2.2
0
 
LVL 8

Assisted Solution

by:santhanasamy
santhanasamy earned 500 total points
Comment Utility
Hi,

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
http://stackoverflow.com/questions/2945274/update-tabs-from-a-tabs-activity-in-a-android-tabhost


Regards
Santhana
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Accepted Solution

by:
roy_sanu earned 0 total points
Comment Utility
Hi,

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,
                        SongsActivity.class);
            intObj.putExtra("USERNAME", name);
                  startActivity(intObj);
                  AndroidTabLayoutActivity parent = (AndroidTabLayoutActivity) getParent();
                  TabHost tabhost = parent.getTabHost();
                  tabhost.setCurrentTab(1);
            }
      }
0
 

Assisted Solution

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

it works with songActvity class if it has

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

Author Closing Comment

by:roy_sanu
Comment Utility
The question i asked was not answered half, other part was done by me
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction This article is a continuation of Part-1 as evident from the title. Please visit this page (http://www.experts-exchange.com/articles/18706/Backing-up-personal-data-on-your-Android-device-Part-1.html) to read the earlier Part -1. If y…
The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now