Back button in emulator is not working

Put your problem here if it does not fit any of the other categories.

Back button in emulator is not working

Postby androidUser » Wed Apr 22, 2009 5:36 am

Back button in emulator is not working,



Find the attached zooming image program example,

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.KeyEvent;
import android.view.View;
public class Zooming extends View {

private Drawable image;
private int zoomControler=20;

public Zooming(Context context)
{
super(context);
image=context.getResources().getDrawable(R.drawable.icon1);
setFocusable(true);

}

protected void onDraw(Canvas canvas) {

super.onDraw(canvas);
//here u can control the width and height of the images........ this line is very important
image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);
image.draw(canvas);




}
public boolean zoomInFixing (int xPixel, int yPixel) {

return false;}


public boolean onKeyDown(int keyCode, KeyEvent event) {

if(keyCode==KeyEvent.KEYCODE_DPAD_UP)// zoom in
zoomControler+=30;
if(keyCode==KeyEvent.KEYCODE_DPAD_DOWN) // zoom out
zoomControler-=30;
if(zoomControler<10)
zoomControler=10;

invalidate();
return true;
}


}
androidUser
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Apr 05, 2009 1:08 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 10 guests