hi android developer On 9/12/11, Marco Alexander Schmitz <[email protected]> wrote: > hi, > > I'd like to inflate a RelativeLayout (with 2 ImageViews) and draw it > into a Bitmap. > > My problem is that measure() always returns a NullPointerException, > altough it is initialized properly. > > main3.xml: > <?xml version="1.0" encoding="utf-8"?> > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ > android" android:layout_width="fill_parent" > android:layout_height="fill_parent" android:background="#fff"> > > <ImageView android:id="@+id/body" android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:src="@drawable/antique_body" > android:layout_centerInParent="true" android:padding="10dip" /> > > <ImageView android:id="@+id/needle" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:src="@drawable/antique_needle" > android:layout_centerInParent="true" android:padding="10dip" /> > > </RelativeLayout> > > In the OnCreate I am doing this: > Bitmap bmp = Bitmap.createBitmap(296, 296, > Bitmap.Config.ARGB_8888); > Canvas canvas = new Canvas(bmp); > > LayoutInflater inflater = (LayoutInflater) > getSystemService(Context.LAYOUT_INFLATER_SERVICE); > RelativeLayout main3 = (RelativeLayout) > inflater.inflate(R.layout.main3, null); > main3.measure(296, 296); > main3.layout(0, 0, 296, 296); > main3.draw(canvas); > > The documentation on View tells me to call measure and layout, so what > am I doing wrong? > > Thanks for any help, > Marco > > -- > 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
-- 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

