Solved

screen layout without all the tabs, android

Posted on 2013-01-08
6
434 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 75

Expert Comment

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

Author Comment

by:roy_sanu
ID: 38754312
I am using Android 2.2
0
 
LVL 8

Assisted Solution

by:Santhana
Santhana earned 500 total points
ID: 38754343
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Accepted Solution

by:
roy_sanu earned 0 total points
ID: 38754452
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
ID: 38765873
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
ID: 38777621
The question i asked was not answered half, other part was done by me
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

734 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