Ok, here is my observation.

On device with Android 1.5 the program is crashing. With 1.6 the
program works fine.

I removed the attrs.xml and using the dimension elements directly. The
crash was gone for 1.5 devices.


On May 11, 10:13 am, T-Droid <[email protected]> wrote:
> No comments?
>
> What I did not mentioned is that there is another file called
> styles.xml which combines the values together:
>
> <resources>
>     <style name="Theme" parent="android:Theme">
>         <item name="theHeight">@dimen/my_height</item>
>    </style>
> </resources>
>
> I'm not really sure if it is a misunderstanding style and themes. The
> InstrumentationTestCases works fine.
>
> Thanks in advance.
>
> T-Droid
>
> On 10 Mai, 15:48, T-Droid <[email protected]> wrote:
>
>
>
> > Hi @all,
>
> > I wrote a test case with ActivityUnitTestCase which was working fine.
>
> > Now I added a dimensions file (dimens.xml) and using the values with a
> > style.xml.
>
> > Here some parts from the dimens.xml:
>
> > <resources>
> >   <eat-comment/>
> >   <dimen name="my_height">15dp</dimen>
> > <resources>
>
> > Here the attrs.xml:
> > <resources>
> >   <declare-styleable name="Theme">
> >     <attr name="theHeight" format="dimension" />
> >   </declare-styleable>
> > </resources>
>
> > And here the style.xml:
> > <resources>
> >   <style name="myStyle">
> >     <item name="android:layout_height">@dimen/my_height</item>
> >     <item name="android:paddingLeft">?theHeight</item>
> >   </style>
> > </resources>
>
> > The style.xml is in the android manifest.
>
> > On the G1 and the emulator the code works fine. In the test case I'm
> > getting a crash.
>
> > 05-10 15:03:48.658: INFO/TestRunner(748):
> > java.lang.UnsupportedOperationException: Can't convert to dimension:
> > type=0x2
>
> > From the call stack I can see that this line causes the crash:
>
> >     protected void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
>
> >         this.setContentView(R.layout.my_layout);
> >    }
>
> > Any idea?
>
> > T-Droid
>
> > --
> > 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 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to