not getting live wallpaper when i set as wallpaper
===

I am trying to make live wallpaper as 2d graphics. but its give error,bwcause its too much high resolution. when i set as wallpaper its give force close.belove i put my whole code  any one help top me .
thanks in advance  


 

    import java.io.File;
        import java.util.ArrayList;
    
    import android.content.SharedPreferences;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.graphics.Paint;
    import android.graphics.Rect;
    import android.graphics.Typeface;
    import android.os.CountDownTimer;
    import android.os.Handler;
    import android.service.wallpaper.WallpaperService;
    import android.util.Log;
    import android.view.SurfaceHolder;
    
    import com.indianic.game.Livewallpaper.drawFrame.MyCount;
    
    public class Livewallpaper extends WallpaperService {
    
        public static final String SHARED_PREFS_NAME = "livewallpapersettings";
        int[] colors = new int[] { Color.LTGRAY, Color.BLUE, Color.CYAN };
        public static ArrayList<String> imageName = new ArrayList<String>();
        private final Handler mHandler = new Handler();
        Canvas c;
        public static String PATH = "";
        static int counter = 0;
        static int time = 20000;
        static MyCount counter1;
    
    
        //Called once to initialize the engine
        @Override
        public void onCreate() {
            super.onCreate();
            imageName.clear();
        }
    
        @Override
        public void onDestroy() {
            super.onDestroy();
        }
    
        @Override
        public Engine onCreateEngine() {
            return new drawFrame();
        }
    
        class drawFrame extends Engine implements
                SharedPreferences.OnSharedPreferenceChangeListener {
    
            private Bitmap image;
    
            final Runnable mDrawCube;
    
            public drawFrame() {
    
                if (counter1 != null) {
                    counter1.cancel();
    
                    Log.e("TIMER", "-----------+++++++++++" + time);
    
                    counter1 = new MyCount(time, 2000);
                    counter1.start();
                } else {
                    Log.e("TIMER", "-----------+++++++++++" + time);
    
                    counter1 = new MyCount(time, 2000);
                    counter1.start();
    
                }
                mDrawCube = new Runnable() {
                    public void run() {
    
                        drawFrame(counter);
    
                    }
                };
            }
    
            private boolean mVisible;
    
            @Override
            public void onCreate(SurfaceHolder surfaceHolder) {
                super.onCreate(surfaceHolder);
    
                setTouchEventsEnabled(true);
    
            }
    
            @Override
            public void onDestroy() {
                super.onDestroy();
                mHandler.removeCallbacks(mDrawCube);
            }
            //Called to inform you of the wallpaper becoming visible or hidden
            @Override
            public void onVisibilityChanged(boolean visible) {
                mVisible = visible;
                if (visible) {
                    drawFrame(counter);
                } else {
                    mHandler.removeCallbacks(mDrawCube);
                }
            }
    
            @Override
            public void onSurfaceChanged(SurfaceHolder holder, int format,
                    int width, int height) {
                super.onSurfaceChanged(holder, format, width, height);
    
                drawFrame(counter);
            }
    
            @Override
            public void onSurfaceCreated(SurfaceHolder holder) {
                super.onSurfaceCreated(holder);
            }
    
            @Override
            public void onSurfaceDestroyed(SurfaceHolder holder) {
                super.onSurfaceDestroyed(holder);
                mVisible = false;
                mHandler.removeCallbacks(mDrawCube);
            }
    
            void drawFrame(int counter) {
                final SurfaceHolder holder = getSurfaceHolder();
    
                Canvas canvas = null;
                try {
                    canvas = holder.lockCanvas();
    
                    if (canvas != null) {
    
                        drawCanvas(canvas, colors[counter]);
    
                    } else {
    
                        drawPic(canvas, imageName.toString());
                    }
    
                } finally {
                    if (canvas != null)
                        holder.unlockCanvasAndPost(canvas);
                }
    
                mHandler.removeCallbacks(mDrawCube);
                if (mVisible) {
                    mHandler.postDelayed(mDrawCube, 1000 / 25);
                }
    
            }
    
            void drawCanvas(Canvas canvas, int color) {
    
                if (imageName.size() == 0) {
    
                    Paint paint = new Paint();
                    paint.setAntiAlias(true);
                    paint.setTextAlign(Paint.Align.CENTER);
                    paint.setTextSize(40);
                    paint.setColor(Color.BLACK);
                    paint.setTypeface(Typeface.create(Typeface.SERIF,
                            Typeface.ITALIC));
                    canvas.drawColor(color);
                    canvas.drawText("ketan", 150, 80, paint);
                } else {
                    drawPic(canvas, imageName.toString());
    
                }
            }
    
            void drawPic(Canvas canvas, String img) {
                try {
                    File imgFile = new File(imageName.get(counter).toString());
    
                    //Log.e("IMAGE NAME", "------------" + imageName.toString());
    
                    image = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
                    canvas.drawBitmap(image, null, new Rect(0, 0, 320, 580), null);
    
                } catch (Exception e) {
                    Log.w("error in DRAW PIC", e);
                }
            }
    
            class MyCount extends CountDownTimer {
    
                public MyCount(long millisInFuture, long countDownInterval) {
                    super(millisInFuture, countDownInterval);
                    Log.v("TAG", "millisInFuture : " + millisInFuture
                            + "\ncountDownInterval : " + countDownInterval);
                }
    
                @Override
                public void onFinish() {
    
                    Log.v("TAG", "" + colors[counter]);
                    counter++;
    
                    Log.v("TAG", "DONE..........");
                    if (imageName.size() > 0) {
    
                        if (counter >= imageName.size()) {
                            counter = 0;
                            drawFrame(counter);
                        }
    
                        else {
                            drawFrame(counter);
    
                        }
                    } else if (counter > 2) {
    
                        counter = 0;
                        drawFrame(counter);
    
                    } else {
    
                        drawFrame(counter);
                    }
                    this.start();
    
                }
    
                @Override
                public void onTick(long millisUntilFinished) {
                    Log.e("TAG", "millisInFuture : " + millisUntilFinished / 1000);
                }
            }
    
            @Override
            public void onSharedPreferenceChanged(
                    SharedPreferences sharedPreferences, String key) {
                // TODO Auto-generated method stub
    
            }
    
        }
    
    }