Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging a textview text dynamically when it is displayed in a tabhost
    primarykey
    data
    text
    <p>Firstly, Im new to android but have years of various other programming experience on unix, windows,but not with Java or android. Im wanting to display a tab with 3 tabs, each having a different layout file (which works). Im working on displaying a "blank" template and then the data is retrieved from an XML file once the user points a setting to one (i.e. via shared preferences). </p> <p>My problem is that the function populateXMLCharacter is never called (using breakpoints). The tab activity always displays "", which is a strig the string.xml. Actually putting a breakpoint in the oncreate function never gets called either. Ive tried using a call to populateXMLCharacter in onResume, but it too never gets called.</p> <p>Im thinking its because of the call to the tab:</p> <pre><code> Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable TabSpec for each tab // Do this and the same for all tabs spec = tabHost.newTabSpec("Description").setIndicator("Description", res.getDrawable(R.drawable.android)).setContent(R.layout.tab_harp_description); tabHost.addTab(spec); </code></pre> <p>Should I be using an intent? I thought the layout was created in a seperate function (in this case harpCSDescription.java and then this allows that activity to be inserted into the tabhost?</p> <p>other functions: public class harpcsDescription extends Activity { </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView (R.layout.tab_harp_description); } //@Override protected void onResume() { // NOW WE ADD DATA TO THE TEMPLATE populateXMLCharacter(); } public void populateXMLCharacter() { </code></pre> <p>Ive tried using intents in the following manner but it simply crashes before any breakpoints are reached.</p> <p><a href="http://developer.android.com/resources/tutorials/views/hello-tabwidget.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-tabwidget.html</a></p> <p>Can some one please guide me to what I should be doing to create an activity with data that is retrieved AFTER the tab is created?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload