Android :: TabActivity - TabContentFactory - Inflated Layouts?
Apr 2, 2009
I have an activity which extends TabActivity and implements TabContentFactory. For simplicity's sake I'll limit the problem to 1 tab.
In onCreate() I do this:
CODE:..........
In createTabContent:
CODE:...........
So far, so great. I get the tab, the layout is displayed.
I also have a button in the layout, so I do:
CODE:.............
And then I subscribe to it's click event:
CODE:..........
Now, here's the problem. I click the button and nothing happens. I can for example execute the following code from elsewhere:
CODE:.............
And the button will get disabled, but when I tap it (in its *enabled* state) - nothing happens.
If I'm not, could it be that I have another tab, where the another inflated copy of the same layout is displayed? However, in this layout's button's OnClickListener nothing happens as well.
View 3 Replies
Sep 6, 2010
I'm creating a game where there's a screen that, for the most part, is shared by four different activites - but a key portion of the screen will be completely different, depending upon which activity is active. Basically, on the left will be an image of the player and along the bottom there will be a row of buttons (let's say for Armour, Weapons, Magic, Skills). This leaves the top-right portion, which will need to dynamically change to represent the button pressed. (So, one moment the top-right portion is the armour selection activity, and the next it's the weapon selection activity, and so on.)
Is this possible? Can I have a layout within a layout and dynamically point the nested layout at a (nested) layout.xml of my choosing? Or, am I looking at just duplicating most of the layout four times (for the four different activities?) Or, am I going to be looking at linking the four activities to a (the top-right) view component, and then having to dynamically construct all of *that* view's child views based on the currently active activity? Well, that's about as much sense as I can make this question make.
View 4 Replies
View Related
Aug 27, 2010
Why aren't menus inflated automatically for you in Android, the way an Activity's layout is?
View 2 Replies
View Related
May 3, 2009
I've got ~200 png files in the /res/drawable folder, mostly interface and sprite sheet stuff. They're all indexed pngs, and weigh in at a grand total of a bit over 400kb.
When I run aapt to package them into the apk, their filesize nearly doubles. Opening the apk up with 7zip and extracting the drawables confirms it: 790kb.
Does anyone have any idea why this would be happening? I thought the packaging process was meant to compress the pngs, not inflate them!
View 4 Replies
View Related
Oct 1, 2010
I have an audio player toolbar activity that has a corresponding layout file.
I need this player to show up at the bottom of another activity. I use a ViewStub and inflate the audio toolbar's layout file in the stub.
How do I access the buttons, etc on this inflated view and how do I set their behavior?
The docs on ViewStub did not mention anything about this (or maybe I totally overlooked something).
View 1 Replies
View Related
Mar 21, 2010
I have built my interface by using ViewStubs, which I inflate during onCreate.
But later in my app, I want to change the View completely, by loading different View into the same place. How do I achieve that?
View 1 Replies
View Related
Aug 6, 2009
I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the draw method on the my canvas?
View 2 Replies
View Related
May 19, 2010
I am trying to inflate an ImageView that scales a Drawable that I can display in a GalleryView. My code to inflate the view seems to work fine, except that the attributes of the ImageView are not applied.Specifically, the inflated ImageView does not have the width/height that I set for it via the android:layout params in XML.Can someone show me what I'm doing wrong?I want to set the width/height of the image in dp, so that it is the correct size across multiple screen dpis and support Android 1.5+.
View 2 Replies
View Related
Jun 12, 2010
I have made a Custom Component in XML, consisting of a button with an imageview stacked on top of it:
<myapp.widget.ClearableCaptionedButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/ccbutton_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@android:drawable/edit_text"/>
<ImageView
android:id="@+id/ccbutton_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_alignRight="@id/ccbutton_button"
android:layout_alignTop="@id/ccbutton_button"
android:layout_alignBottom="@id/ccbutton_button"/>
</myapp.widget.ClearableCaptionedButton>
Extract of java source code:
public class ClearableCaptionedButton extends RelativeLayout implements OnClickListener {
...
public ClearableCaptionedButton(Context context, AttributeSet attrs) { super(context, attrs);
// some stuff that works fine
} ..
protected void onFinishInflate() { super.onFinishInflate();
mButton = (Button) findViewById(R.id.ccbutton_button);
mClear = (ImageView) findViewById(R.id.ccbutton_clear);
mButton.setText(""); // error here: mButton == null
}
My problem is similar to this one. When I try to find the views inside the custom compound, findViewById returns null. But, as you can see, i already added super(context, attrs); to the constructor. I am using the custom component directly in xml layout, like this:
<LinearLayout>
<!-- some stuff -->
<myapp.widget.ClearableCaptionedButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:caption="to"/>
</LinearLayout>
View 1 Replies
View Related
Apr 2, 2010
Im using an inflater inside an adapter for my listview. I need to add in a different button depending in the state of the data for each row, so Im thinking I need to do this programmatically, but how do I make sure its inserted into the correct place inside the layout?
View 1 Replies
View Related
Apr 26, 2010
While researching how to create custom compound views in Android, I have come across this pattern a lot (example comes from the Jteam blog)I mostly understand how this is working, except for the part where inflate() is called. The documentation says that this method returns a View object, but in this example the author does not store the result anywhere. After inflation, how is the new View created fromt eh XML associated with this class? I thought about assigning it to "this", but that seems very wrong.
View 1 Replies
View Related
Jun 15, 2009
I created a TabActivity with contains 3 tabs. Each tab's content sets different Intents.I would like to add a "footer" wich will appear on each tab. So I get TabActivity's FrameLayout and add it my footer view.Is it possbile to define where place the footer (with an attribute like AT_BOTTOM)? So contentTab dimensions are calculated according to this footer.
View 4 Replies
View Related
Oct 12, 2010
I have a TabActivity with 3 tabs. Each tab contains its own Activity. When one of the contained Activities pops up an AlertDialog, there are actually 3 dialogs created. The dialog has a Dismiss button and it must be pressed 3 times to finally dismiss the 3rd dialog.
View 2 Replies
View Related
Oct 1, 2009
How can I return a value from TabActivity? It seems that the return value from tab pages vanishes and the caller always receives RESULT_CANCELED instead of RESULT_OK.
View 3 Replies
View Related
Aug 18, 2009
More of a TabWidget question I guess really...
I would've tried to send a screenshot for this query if I could, but i'll try and explain.
I have 3 Tabs, each showing a separate Activity. Underneath those tabs (and above the activity display), I want to display a header. This header would probably be a Layout of some sort with a TextView inside it and a background 9patch.
Is this possible, if so how?
View 2 Replies
View Related
Feb 2, 2010
I am having a problem.I want to explain in detail. 1)I am Having an TabActivity with 5 tabs. I loaded content as follows.
CODE:............
And the Problem is If i want to start activity which is not specified in tabhost in above Java code,it is going out of tabactivity. ie.,It is not coming in tabactivity.
2)But i want to have all the activities under tabActivity.
View 4 Replies
View Related
Aug 12, 2010
I create a TabActivity from Several ListActivities.
The lists are created from a cursor load in a AsyncQueryHandler. I have got no problem to load the content of the list.
After that I run an insert in the AsyncQueryHandler, and I meet the following error. The insert is done by the listActivity.
If I run my listActivity individually and that I do my insert, everything is find. Do know why ?
CODE:.......................
View 3 Replies
View Related
Mar 26, 2010
I'm having some difficulties getting the TabActivity to work.
Here's the implementation of the class:
CODE:..........
The problem is that I call this class from my main activity (which is a MapActivity if it matters) and when I do the TabActivity doesn't show. It registers the click on the option menu and it even starts the intent but the screen doesn't change..it just stays on the main activity and i see in the logs that the main activity gets resumed.
I call it like this:
CODE:...............
Like I said...there are no errors (the classes called from the tabs exist of course), just no actions. I put some log commands into the onCreate function in the tabactivity (as you see) and they all get written into the log...I have no idea what I'm doing wrong here.
View 3 Replies
View Related
Dec 7, 2009
I'm working on Android v1.5. I want to use a TabActivity with 6 or 7 or more tabs. However, I do not want to clutter my screen with so many tabs together. Hence, I'd like to be able to show, say, 3 tabs on the screen, and to be able to scroll to the other tabs. How may I achieve this? I could not find any example for this by Googling.
View 5 Replies
View Related
Apr 13, 2010
Can I make TabActivity start it's childs activities for result? I need it because I can't make result code from a tab to propagate all the way up in the chain (it's reset in the TabActivity)
View 1 Replies
View Related
Aug 18, 2009
I have a TabActivity based class which has 3 tabs. All are ListActivities (but that's not important for this problem)
I'm updating the TabHost's TabSpec's to change the text on the tabs. This works fine and the ListActivities display correctly.
Iater on the execution flow I need to update the Text on the tabs from "Current Text" to "Current Text (3)", for example. I update the TabSpec.setIndicator() with the new text, and attempt to call invalidate() on the TabWidget (and all it's children). But the tab text refuses to update!
View 5 Replies
View Related
Nov 17, 2010
I have been trying to reuse the tutorial on the Android developer website about developing a TabActivity App but, unfortunately, it never worked, even when I constructed it the exact same way as it is described...
Using the debugger it seemed the problem came from the main layout.
-> setContentView(R.layout.main); //After this line the app stops.
Here is my main.xml:
CODE:.............................
View 1 Replies
View Related
Jun 20, 2010
I am trying to override the behavior of a TabActivity that has other Activities as children. I have made all of the children activities return false in onKeyDown so that the key will propagate through to the parent.However, this is not the case.The only key that is being recognized is the search key.Back, menu, and home are not being overridden.
View 6 Replies
View Related
Feb 10, 2010
I have issues with displaying a ListActivity in a TabActivity.
The super simple code below causes a crash.
CODE:.....................
View 5 Replies
View Related
Apr 30, 2009
I have problem with extends TabActivity.
My code is:
CODE:.................
View 6 Replies
View Related
Jun 30, 2009
I have a Tabbed View that displays a list in different tabs. When I click on the currently active tab (not the displayed view) I want to do something. Currently - the OnClickListener is NOT called. the OnTabChanged Listener however seems is working fine. Am I registering on the wrong View?
CODE:..................
View 3 Replies
View Related
Jul 21, 2009
I have a TabActivity, there are 4 tabs. In each tab I have put a single Activity. One of the activities contains a Custom List View which uses a CustomAdapter which extends the BaseAdapter.
I get this excpetion, when I try to open the tab containing this activity. It seems to be thrown at a point when probably the TabActivity is being re-drawn. Can anybody please suggest some alternatives, or solutions to avoid this problem.
Here is the stack trace.
CODE:.................
View 3 Replies
View Related
Aug 21, 2009
I wanna put a "List" inside a TabActivity. by google and coder's guide, my work out "direction" is to create a "TabActivity" as MAIN and "ListActivity" then add it in the "TabHost" and turn out code something like (below) and fail:
CODE:.........
I know i may need to spend more time on the BOOK and google for android development, but i also feel that the resource for android is quit scattered and not detail. (i'm a developer of C# for a few years, and it's more easilier to search for information)
View 2 Replies
View Related
Aug 4, 2009
I'd like to start a service from a tabactivity (I first tried in the activity launched for a tab but it seems taht there is a technical limitation).
So inside my TabActivity I defined a method named startService() which is quite simple:
> instanciate a new Intent > call the method startservice > Inside my "tabbed" activity (I mean inside a tab) I make a reference to the TabActivity and I call the method startService.
View 2 Replies
View Related
Mar 13, 2010
I have a TabActivity, each tab holds an activity. At some point I'd like to 'refresh' the tabs. I'd basically like to restart each activity in the tabs. I'm not sure how to do this. Calling:
CODE:.........
Removes the tabs, but the activities still seem to be in alive, in limbo. How can I get them to really quit?
View 2 Replies
View Related