hi,
I see a strange problem when I try to set a TextView, instead of a
layout file via setContentView.
Case 1:
i.e. if I do the following, it works fine...
TextView tv = new TextView(this);
tv.setText("Hello World");
setContentView(tv);
Everything is OK.
Case 2:
But suppose I have a main.xml file with a TextView in it and I try the
following:
===========
View tv = findViewById(R.id.textview);
setContentView(tv);
===========
I get a Force Close with the below error
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): Caused by:
android.content.res.Resources$NotFoundException: Resource ID
#0x7f050001 type #0x12 is not valid
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): at
android.content.res.Resources.loadXmlResourceParser(Resources.java:
1801)
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): at
android.content.res.Resources.getLayout(Resources.java:685)
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): at
android.view.LayoutInflater.inflate(LayoutInflater.java:318)
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): at
android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-27 00:08:26.620: ERROR/AndroidRuntime(1595): at
com.android.myhelloworld.SimpleActivity.onCreate(SimpleActivity.java:
22)
Case 3: I even tried to inflate the xml and set the view but even that
resulted in a force close.
Am I missing something here ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---