Getting different views in Tabs

by tysmailbox » Thu, 31 Dec 2009 05:09:48 GMT


Sponsored Links
 I have an app with 2 tabs, the first is a listview, and the second I'm
trying to make a TextView. The problem is I have no idea on how to get
the TextView to show up. The listview is working, but I can't get
anything on the TextView at all. I tried using the Hello, World to try
to work with the text into the tab, but I can't figure it out.

My main.xml section with the TabWidget looks like this:
-----------------------------

    <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <ListView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/itemlist" />
            <TextView
                android:id="@+id/HelloAndroid"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"/>
        </FrameLayout>

-----------------------------
ListView is being used on the java file with the mTabHost code,
-----------------------------

        TabHost mTabHost = getTabHost();

    mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator
("Answer").setContent(R.id.itemlist));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator
("Ask").setContent(R.id.HelloAndroid));

    mTabHost.setCurrentTab(0);
}
-----------------------------

The TextView is on a different file called HelloAndroid.java, and the
code looks like:
-----------------------------

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);
       tv.setText("Hello, Android");
       setContentView(tv);
   }
}
-----------------------------

How can I fix it so that the 2nd tab brings up the example text?
Thanks!

--



Getting different views in Tabs

by tysmailbox » Fri, 01 Jan 2010 09:09:35 GMT


 Nevermind I got help from someone by adding
---
Intent i = new Intent(this, HelloAndroid.class);
 mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator
("Ask").setContent(i));
---
in place of the second mTabHost




--


Sponsored Links


Other Threads

1. separate UI window of the Background Thread

Hi all,

   During the processing of the background thread, I want to create
another GUI window (of b/g thread) which will overlap the main UI
thread and show b/g processing and this window will be killed when b/g
thread will be over.

   Can anyone suggest how to accomplish this task?? Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~

2. System packages signatures and permission

Hi,

Running the emulator from sdk version: android-sdk-windows-1.1_r1,

I have extracted using ADB all packages located under

system/app/*.apk

and

system/framework/framework-res.apk

Then using,

jarsigner -verify -verbose -certs *.apk

One can view the certificates used to sign these various packages.

They are all signed with the same certificate parameters.

 X.509, emailaddress=andr...@android.com, CN=Android, OU=Android,
O=Android, L=Mountain View, ST=California, C=US


Does it mean, they are really signed with the same key?  How could I
verify that?

They appear to be signed by Android (Google). I guess that if I
rebuild the Android image for the emulation, it will be always the
same private key used? if yes, this means that this private key should
only be used for development purpose.

For a commercial product, I guess, the OEM shall sign these packages
with its secret private key?


Then, I have extracted the permissions of each packages using

aapt d permissions *.apk

I compared them to the declared permissions provided by "Frameworks
\base\core\res\AndroidManifest.xml"
corresponding to the framework-res.apk ( the android protected API).

None of the framework permissions protected by "signature" or
"signatureOrSystem" are used by any of these application packages.

Why? All the used ones by application packages are basically either
Normal or Dangerous.
All these system applications are already installed by the OEM. So,
the OEM will already authorize these permissions on behalf of the end-
user.

 However, for any new application installed by the end-user, it seems
that a lot of security responsability is handed on the end-user
shoulders?

Isn't it due to the central design choice of not having a CA to
control capability approval of the applications?
 I mean not having a CA and application/capability approval process,
but letting every application developer signing its application
without any approval.

Indeed, if most of the declared framework APIs were protected by
signature, it would force every application
developpers to get their applications signed with the same key (used
to sign the framework packages). In this case, it will be the OEM key
or a common google secret private key. So, we would end-up with a kind
of CA ( OEM or google ). correct?


Guillaume

3. MapView in SDK 1.5

4. res PNG filesize inflated upon packaging

5. Support for iterations in xml view - Dynamic Data display

6. Template ROW using xml and api

7. AOP support