I know the title looks weird but this is what I want :
I have two tabs, and under one tab I have an activity that has a file list. When you click on a file it normally shows a panel next to it (which is another activity). But now, since I have tabs, when I click on a file it jumps to a full screen activity with the file description and the tabs are gone. I would like to make this second activity a sub-activity of the main where we can select a file so that the tabs stay still.
Any ideas ?
Thanks,
Nic.
Tab host with fragments should solve the issue.
You may like to read this - http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
Related
i have to jump from activity A to fragment2 in activity B(in the activityB, i use the viewpager,which contains four fragment).what i want is when i use the upNavigation of the actionbar ,i just jump to the exact second fragment.
can anyone help me?(i have searched for some related questions ,but it seems they all navigate in/between the fragments,which is not my want.)
Use this , detect the onclick
ViewPager.setCurrentItem(pageNumber);
above line will navigate you to that page
I am trying to implement a navigation drawer (left slide menu) in my Android project. My application has a main activity till now, in which you could navigate to others with Intent method through buttons.
So, I searched for a navigation drawer and I found/followed the exact steps of THIS tutorial. My code related to the menu is exactly the same, so for that reason, I am not posting it below.
Related to my code:
The three fragments that I created, were just extended the class Fragment and where completely empty.
The ONLY change from the code in the tutorial, is inside the res/layout/activity_main.xml, because I changed the com.codepath.examples.navdrawerdemo.FragmentNavigationDrawer to 'my_project's_name'.FragmentNavigationDrawer.
What I managed to do:
I managed to create the menu that I want and display it ONLY if I make the MainActivity.java as the launcher inside the AndroidManifest. When I see the menu, I can go to each fragment through it, but I can't go to any of my Activities because I didn't link the fragments with the activities that I want. My menu, also does this transition that it should, so I am completely fine with the style of it.
What I want to do:
I just want to have the same menu inside every activity that I have already created, and when I click in an item in the menu, I want to navigate to an activity that I want BUT I want the activity to still display the menu.
I searched for solutions, but when I put back my first Activity as launcher in the Android Manifest, and set a layout for example inside the Fragment for it, it's just a useless layout. And when I tried to do an Intent to call my Activity inside the Fragment, the menu disappeared.
P.S I didn't changed any of my Activitie's code or of their layouts. I added only the code from the tutorial!
I am working on a Tab Activity. I have one activity as a tab content
of one tab. I need to use the same in another tab also.so I have set
the a single activity as a two tab content. But when I am running my
code . If I am selecting the TAB1 after that I am selecting TAB2.
Again I coming back to TAB1. whatever event like entering name in
edittext is reflecting in TAB2 not in TAB1.I don't know understand why
its happening.
Any Idea? Thanks in Advance.
You haven't mentioned that what you are doing onTabChanged ie. whether you are starting that activity again or not.
I think everytime when you are selecting a tab you are staring an Activity.
startActivity(intent);
So, whatever change you have made in that activity under Tab2, won't reflect on that activity under Tab1 as you are starting that activity again.
If you are starting that activity everytime ontabchanged, then you have to save the changes what you have made under any tab.
As you haven't mentioned clearly what you are doing, so if you are doing something else, let me know.
I'm creating the 3 tabs dynamically based on example here http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
the application works well except one issue.
when I launch app and then click the Back Button then the app closes.
I launched the app by clicking on the application icon.
now I can see 6 tabs. each time I repeat this process, it keeps on adding 3 tabs.
when ever I use Menu button instead of back Button then it doesn't add 3 tabs.
anything going wrong here, how can I fix it?
thanks
Are you creating the tabs at onResume() or onStart()? Try to create them at onCreate()
or delete the tabs by onPause with something like:
LinearLayout tabbar = (LinearLayout) findViewById(R.id.tabbar);
tabbar.removeAllViews();
i've got a tabbed layout, and on one of the tabs i have a search functionality. When the user makes a new search, i need to show the results. However, doing so involves starting another activity to handle the search results.
this causes the tabs at the bottom to disappear. The user can get the tabs back by clicking on the 'back' button. But somehow, in the context of my application this can be a bit counter-intuitive and seems to be break the common layout flow.
is there any way to prevent the tabs from disappearing when invoking the search from one of the tabs?
thanks for any help/suggestions.
as far as i can understand your problem, You are not using tabs then you are using buttons. see some tabhost tutorials on how to create a tabbed activity. what you are doing is launching a new activity instead of just switching a tab in the existing one.
Also the other things you can look for are activity groups.
Hope this helps you somehow.