problem about android-canvas-Collection of common programming errors


  • Umar Farooq
    android android-canvas
    I am new to android, I am trying to make game in android. In that game I have to draw canvas, I followed a tutorial to learn “How to draw canvas in android”. In that tutorial he is using two classes named as GFX and Main, he is not showing any XML file, so I am using its default XML which is populated by eclipse editor automatically.I have followed the tutorial, but when I try to run that application on my device a message appears on my device screen, Unfortunately,Seven has stopped. “Seven” is

  • theblitz
    android android-canvas
    I am getting an UnsupportedOperationException when using Canvas clipPath.This is happening on an HTC Sensation XE (4.0.3). It works perfectly on other 4.0.3 devices.This is the code:@Override protected void dispatchDraw(Canvas canvas) {canvas.save();canvas.clipPath(this._mClip);super.dispatchDraw(canvas);canvas.restore(); }It fails on the “clipPath” with the following stack:11-06 12:05:53.650: E/AndroidRuntime(25021): FATAL EXCEPTION: main11-06 12:05:53.650: E/AndroidRuntime(25021): java.lang.Un

  • Kara
    java android multithreading android-canvas surfaceview
    I’ve been struggling with this exception and I’ve looked around but there’s nothing to help me.Here’s the codepackage com.example.surfacetest;import android.app.Activity; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.Surface.OutOfResourcesException; import android.view.SurfaceHolder; import android.view.Sur

  • Kara
    android multithreading segmentation-fault android-canvas surfaceview
    I’m making a grid + tile activity where tiles need to move across the grid. The grid (and tiles) are being drawn on a surfaceView in a separate thread to the UI (UI deals with touch events and pushes them onto a queue for the grid to process). This is all fine. I have a toolbar from which I can drag tiles. The toolbar is a View which has been added to the relative layout (and runs on the UI thread). No matter how many times i use synchronize or try to safeguard the canvas from being written to a

  • Mikko P.
    android android-canvas live-wallpaper runnable surfaceholder
    I’m building a live wallpaper, it has a bitmap with fullHD resolution which is scaled down to the size of the users phone screen. It works perfectly on Android 2.2 and 2.3 but crashes on 4.0.EDIT :I narrowed the problem down a little bit using try/catch and found out it starts from my run() method. With that MacGyver fix it runs about 20 seconds flooding the following error message and then crashes:05-31 20:01:22.590: E/SurfaceTextureClient(1475): dequeueBuffer failed (No such device) 05-31 20:0

  • Chiru
    android android-canvas android-custom-view
    i have prepared paint application,my application contains one custom view for paint.when we draw any thing in custom view just collect the drawn pixels and store in array list,first it’s working fine(but it’s taking lot of time) and second time ” Activity MyAlphabets(in application MyAlphabets)is not responding(force close and wait)”.My code is,public void onDraw(Canvas canvas) {if (myDrawBitmap == null) {myDrawBitmap = Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(), Bitmap.Config.ARGB

  • Kara
    java android bitmap android-canvas ondraw
    The goal is simply to draw a bitmap and over the top of it draw shapes that ERASE the underlying area of the bitmap.I have created simple proof of concept code to try and understand how exactly I should go about this. In the various threads here I have found numerous hints about using:android.graphics.PorterDuff.Mode.CLEARThe code below simply creates a screen with a blue background and adds a custom view. This view draws on its canvas a pink background, the bitmap image (with a slight border to

  • Simon Sarris
    android opengl-es overlay android-canvas
    I’m attempting to add an overlay to an Android opengl ES application, and am currently specifying an ImageView and working off code from SurfaceViewOverlay API Demo, effectively merging two applications I wrote, one that was canvas based and one with opengl ES.Due to merging two projects there was a large amount of copy paste involved and which lead to me accidentally using a null surface holder. Surprisingly this worked but threw a large number of warnings. Changing it to the surface holder of

  • Optimus
    android android-canvas android-imageview
    I want to add some text on top of an image. I read the image from the sd card and set it to a Bitmap variable.Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());Then I added it to a canvas. The code I used is given below,Canvas c = new Canvas(myBitmap);But when I added this line, the app crashed at that point. Why is it and how can i solve this ??Note : Above mention code lines are inside onActivityResult method.

  • Loktar
    android exception android-canvas
    I am using the image crop library from here https://github.com/lvillani/android-cropimage in my project to crop images stored on device. However, certain users are reporting crashes with the following stack tracejava.lang.UnsupportedOperationException at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:413) at com.android.camera.HighlightView.draw(HighlightView.java:101) at com.android.camera.CropImageView.onDraw(CropImage.java:783) at android.view.View.draw(View.java:11006) at android.view.

  • Apoz
    android google-maps android-canvas google-maps-android-api-2
    I’m displaying a GroundOverlay on my map whose image is made with a canvas on which I drew an arc, but I’m running into a few problems : first of all, the applications crashes after a little while (it’s giving me a java.lang.OutOfMemoryError), and it’s not showing the overlay. I have tried putting on a white background in the overlay’s picture and it does display it, so I guess the problem comes from the arc, but I can’t tell what I did wrong. Anyone has any idea ?Projection projection = map.get

  • Jeroen van den Broek
    java android android-canvas android-4.3
    Before you spend more time reading this than necessary: I will be answering this question myself. I spent a full day debugging this and thought I should share.I am the developer for an application that is basically a sort of turn-by-turn navigation on golf courses. As such, I have images that need to be rotated to make the image north-oriented. This obviously requires some matrix transformations.After Android 4.3 got pushed to the HTC One, I got a few complaints that the app was simply closing w

  • AndreaF
    android android-canvas
    I’m trying a simple CustomView with canvas. This custom view simply change the position of an icon picture on the screen randomly when is invoked updatePosition(), and in my intention should move the image on drag, scale on pinch… and when I touch a position in the screen should appear in the clicked position.My try is the follow public class CustomView extends View {Bitmap mBmp;Random mRnd;Paint mPaint;private static final int INVALID_POINTER_ID = -1;private float mPosX;private float mPosY;p

  • iappmaker
    android android-canvas android-image
    I am testing the app on my phone (size 720×1280). The app runs fine when I use the sample size of 2. When I tried to use the sample size of 1 the app crashes in the line where I draw the image (code mentioned below). Please point me where my code need correction.canvas.drawBitmap(backgoundImage, 0, 0 , null); Codepublic Bitmap getAssetImage(Context context, String filename) throws IOException {AssetManager assets = getApplicationContext().getResources().getAssets();InputStream buffer = null;t

  • Latcie
    android android-canvas surfaceview
    I have a simple surfaceView and a thread as below.I’m trying to start simple and just paint the background of surfaceView a certain color.package com.example.surfviewtest;import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.view.SurfaceHolder; import android.view.SurfaceView;public class SView extends SurfaceView implements SurfaceHolder.Callback

  • Ankuj
    android android-canvas face-detection
    I have this codepublic void DetectFacesInImage(View view){BitmapFactory.Options bitmapFactoryOptions=new BitmapFactory.Options();bitmapFactoryOptions.inPreferredConfig= Bitmap.Config.RGB_565;//int resID = getResources().getIdentifier(picturePath , “drawable”, getPackageName());myBitmap=BitmapFactory.decodeFile(picturePath,bitmapFactoryOptions);int width=myBitmap.getWidth();int height=myBitmap.getHeight();detectedFaces=new FaceDetector.Face[number_of_faces];FaceDetector faceDetector=new FaceDetec

  • Seraphim
    android crash paint android-canvas sigsegv
    I’m using a low cost tablet with Android 4.0.3. HEre the log:06-11 23:36:04.653: D/SynopticElement(1583): Size changed to 200×200 06-11 23:36:04.693: D/dalvikvm(1583): GC_FOR_ALLOC freed 62K, 12% free 7275K/8199K, paused 33ms 06-11 23:36:04.713: D/SynopticElement(1583): Size changed to 190×190 06-11 23:36:04.733: D/dalvikvm(1583): GC_FOR_ALLOC freed 9K, 12% free 7583K/8583K, paused 22ms 06-11 23:36:04.743: A/libc(1583): Fatal signal 11 (SIGSEGV) at 0xc52c9d4c (code=1)Debugging my code:canvas.sca

  • iappmaker
    android android-canvas android-image
    I am testing my App in the Emulator. Emulator Device Size – 480 x 854 Image size – 1280 x 720 Sample size = 1 (This is from the process explained in the Android reference – http://developer.android.com/training/displaying-bitmaps/load-bitmap.html)When I trigger this activity the App goes fine, When I traverse to next activity and come back, the App crashes with OOM. I have followed the process explained in the android manual for loading the bitmap efficiently, but still it fails in the linebackg

  • jaybee
    android android-camera android-canvas android-orientation
    I am using a SurfaceView to draw on top of the camera preview, adapting code from this tutorial. The app works at first then crashes on orientation change, sometimes on the first change, sometimes after changing two or three times. I’ve seen quite a few similar questions but none has a solution (for my case). This is the exception:05-09 22:14:48.384: D/libEGL(829): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 05-09 22:14:48.400: D/libEGL(829): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_S

  • Simon Sarris
    android bitmap edittext android-canvas
    I have an editText, and I want what is being typed in it gets drawn on the canvas which has my resource called “ger”. I made a simple code, but In don’t get it to work. IDK what is the problem, when I run it, it stops unexpectedlythis is my class codepublic class StartActivity extends Activity {/** Called when the activity is first created. */static Bitmap bmp; static EditText et; static ImageView iv;@Override public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);se

  • iappmaker
    android android-canvas android-mediaplayer
    I have 2 activities. Main Activity -> A and child Activity -> B. Activity A uses the canvas to place some images at desired position and also it plays some background music. Activity B triggered from A where it uses a media player and viewFlipper. For every flip I used to play a flip sound.Issue : Whenever I press back while the flip is in progress, I get the following error in main Activity A. Kindly Advice. Thanks in AdvanceLogCat04-20 10:29:06.779: E/SurfaceTextureClient(5938): dequeueBuffer

  • Elyas369
    android android-layout android-canvas android-tablelayout
    I am trying to implement a HUD display to my cutsom keyboard. The HUD will contain pairs of key/value. I need to programatically create a TableLayout and draw it on my canvas. In order to do this, I am overriding the keyboardview onDraw() method:@Override public void onDraw(Canvas canvas) { // In the custom MyKeyboardView classMyHUD hud = new MyHUD(getContext());super.onDraw(canvas);hud.tl.draw(canvas); //tl being the TableLayout to draw }MyHUD class:public class MyHUD {public TableLayout tl

  • user1844130
    android android-canvas
    Here in this timer code runOnUiThread( new Runnable) is undefined in a class which extends view. Is this possible to use this code in class which extends View. Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() {runOnUiThread(new Runnable() {@Overridepublic void run() {view.invalidate;}});} }, 40);

  • Loktar
    java android alertdialog android-canvas looper
    Here’s a screenshot of my AlertDialog’s unresponsive state:In the background, the green tile, the red ball inside a the black-and-white target, all three of the bitmaps are continuously rendered on a rendering thread that locks/unlocks the background Canvas on my phone. This unresponsive action always execute when I press the OK button, regardless of what text I put into the EditText.Here’s the code:PlayActivity class:package nttu.edu.activities;import nttu.edu.graphics.RenderView; import nttu.e

Web site is in building

I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money