Hai all.......

I am creating a custom view without using xml... using java code...My 
question is how could I add new button to my  view class using java 
code....My code is just like below.....


public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
           
       MyView view1 = new MyView(this);     
      setContentView(view1);


    }

public class MyView extends View {

public MyView(Context c) {
            super(c);
            mBitmap = MainActivity.getBitmap();
            
        }

@Override
        protected void onSizeChanged(int w, int h, int oldw, int oldh) {
            super.onSizeChanged(w, h, oldw, oldh);
            mBitmap = Bitmap.createScaledBitmap(mBitmap, w, h, true);
            mCanvas = new Canvas(mBitmap);
            
        }


@Override
protected void onDraw(Canvas canvas) {
            canvas.drawColor(0xFFAAAAAA);
           
            canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
            canvas.drawPath(mPath, mPaint);
        }

}

It is not my full code...I need to add some custom button and some menu. I 
have to draw to the canvas using all these...Is it possible to add such a 
button and menu in view using java....

Thanks in advance.......

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to