hi all android gurus,

I recently started android programming and stuck on custom views
I have seen a number of posts similar to me with some tips,
suggestions etc
but none worked for me....

heres my problem

I have my main activity defined in main.xml which has got a button to
display another activity


which is something like

<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android";
android:orientation="vertical">

<View class="android.pvee.vm.animateview" android:id="@+id/
animateview01" android:layout_gravity="top" android:layout_weight="1"
android:background="@drawable/vmquad"
android:layout_width="fill_parent"
android:layout_height="fill_parent"></View>

<TableLayout android:id="@+id/TableLayout01"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TableRow android:id="@+id/TableRow01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal">
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Home"></Button>

...
...

</TableRow>

</TableLayout>
</LinearLayout>

in manifest file I declared above activity as <activity
android:name=".<activity name>" />


and for the button click


btnStart.setOnClickListener(new Button.OnClickListener() {
                        public void onClick (View v){
                                  Intent animate = new Intent(v.getContext(), 
<activity
name>.class);
                                  startActivityForResult(animate, 0);
                        }



I have custom view class animateview which overrides ondraw

public class animateview extends View {

        public animateview(Context context, AttributeSet attrs) {
                super(context, attrs);
                Log.i("animateview", "in constructor");
        }

/*      @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{

                Log.i("animateview", "in on measure");
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
                setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight());
        }*/


        @Override
        protected void onDraw(Canvas canvas) {

                Log.i("animateview", "in draw" + canvas.toString());
                canvas.drawText("this is a test", 20, 10, null);

        }

}

but when this activity is called onDraw never called..or onMesure
I have overridden onMeasure to set size but It didnt work...
and I put log message in the constructor of this class - didnt work

but when this activity is called the custom view background image is
drawn by the layout which is set in above xml


any tips would be greatly appreciated..I can post more details or code
snippet if u want

thanks in advance

regards

pvee

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