referencing ints from other classes

Posted by user357032 on Stack Overflow See other posts from Stack Overflow or by user357032
Published on 2010-06-14T02:28:55Z Indexed on 2010/06/14 2:32 UTC
Read the original article Hit count: 301

Filed under:
|
|
|

if i wanted to reference an int from another class how would i go about doing that???

public class Zoom extends View { private Drawable image;

  public int zoomControler=20;
    public Zoom(Context context)
    {
            super(context);
            image=context.getResources().getDrawable(R.drawable.icon);
            setFocusable(true);      
    }

@Override

protected void onDraw(Canvas canvas) {

// TODO Auto-generated method stub

super.onDraw(canvas);

image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler); image.draw(canvas); }

} class HelloOnTouchListener implements OnTouchListener{

@Override

public boolean onTouch(View arg0, MotionEvent arg1) {

  return true;
}

}

in this case i want to reference the zoomControler from the first class in the second helloontouchlistener class

© Stack Overflow or respective owner

Related posts about android

Related posts about class