I am creating an android application, in which I used tabs. There are six tabs which shows different activities. Last activity in tab have one button(clear). When we click on button, I want to clear all views in tab. Is it possible. Please guide me.
Just Call another blank activity inside the onclick event of the button.
Try use Fragments instead of Activity for every tab,
this way you could clear the tab much more quickly with FragmentManager
Related
I am developing an app in which I have an on boarding. I have a "next" button at the bottom of the layout which will load the next fragment. The problem is how to do this when I will have to go through 8 fragments. The order in which the fragments will be displayed, never changes. Should I use a counter or should I ask which fragment is being displayed and then go to the next? Any help is welcomed, thanks.
im trying to implement an android aplication when your activity, cointains 3 or more 'main windows' like in the image -> 'A'. 'B'.'C'. so how is posible make when you slide you touch screen change from A, to B, for example, i was thinkin in a horizontal view, and inside of each item use a relative layout, but im not sure, its my first time with this kind of problem, thanks.
Try using android ViewPager. Each ImageView would be inside a Fragment that would reside inside your Activity. Check out this example
Use Tabbed Activity template when you want to make this type of Activity. ViewPager, Adapter and tab layout will be automatically implemented for you. Just make small changes in your Adapter according to your needs and use one Fragment for one tab and you can create as many tabs as you want in an Activity.
If you want i will post an example of an Adapter as i just implemented an Activity with 3 tabs.
To get your basics strong on ViewPager, tab layout and Fragment sections adapter read out this link.
I have gotten my tabs up and running with Sherlock Fragments. So i have two tabs and two fragments. Now what i want is that when i click on a button in one of the fragments, I want another fragment to open up, but it should be inside the tab that contained the original fragment. Can anyone show me how this can be done ?
Actually Nested Fragments are not possible directly. I had a similar issue and but the Fragment to be shown was small and simple. So I just played with setVisibility() as LinearLayout.GONE and LinearLayout.VISIBLE
On the Fragment initialization, I hid the second layout and when I need to show the other fragment, I hid the first layout and showed the second layout. It worked great for me!
I am creating a tabbed application and the main activity for one of the tabs is a listing of departments. When you click on a department it starts a new activity that lists the documents in the department.
My issue is when it shows the document listing, the tabbed view goes away. And I would like to keep the tabs on the top constantly. I have attempted to extend the TabActivity to each of the activities that are started under the tab, but then the listviews create over eachother.
I have also attempted to create the tabs without a tablistener starting an activity, so I can only create the listener if it is the first time the tab is called, but that is not allowed.
Any help would be appreciated, maybe there is some method I am completely missing?
Thank you!
And I would like to keep the tabs on the top constantly.
Then you should not be starting an activity when the user taps on tab. Your tab contents should either be fragments or something else manipulated by your TabListener. The concept of activities being the contents of tabs is now deprecated (and, IMHO, was a bad idea to begin with).
I have attempted to extend the TabActivity to each of the activities that are started under the tab, but then the listviews create over eachother.
You will notice that TabActivity is deprecated, specifically for the activities-as-the-contents-of-tabs concept.
In my app I have four tabs in the bottom of my main screen. When the user click in one of the tabs in the bottom it open an Activity and the user needs to fill up a form, after the form is done it returns to one of the TabActivities.
Everything works well, except when the form is save its supposed to go to the Activity an show the four tabs in the bottom. The problem is that the tabs in the bottom disappear.
I thought the if Im calling the TabActivity it will always show the tabs that were assign in the XML layout.
Okay you have to go for ActivityGroups. But in later version of android Activity Group is deprecated and hence you have to go for fragments or views. Here are few links which will get you started.
ActivityGroup Example
http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/
http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity