-I wonder what is the error code that displays the following error. The problem is when I change the size and you want to look at the fault lines vkaterih see the latter:
09-10 03:23:48.096: W/KeyCharacterMap(4667): No keyboard for id 0
09-10 03:23:48.106: W/KeyCharacterMap(4667): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
09-10 03:25:12.476: W/dalvikvm(4667): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
09-10 03:25:12.486: E/AndroidRuntime(4667): Uncaught handler: thread Thread-8 exiting due to uncaught exception
09-10 03:25:12.486: E/AndroidRuntime(4667): java.lang.IndexOutOfBoundsException: Invalid location 1, size is 1
09-10 03:25:12.486: E/AndroidRuntime(4667): at java.util.ArrayList.get(ArrayList.java:341)
09-10 03:25:12.486: E/AndroidRuntime(4667): at somitsolutions.training.android.androidpaint.AndroidPaint$Panel.onDraw(AndroidPaint.java:641)
09-10 03:25:12.486: E/AndroidRuntime(4667): at somitsolutions.training.android.androidpaint.AndroidPaint$TutorialThread.run(AndroidPaint.java:736)
09-10 03:25:12.496: I/dalvikvm(4667): threadid=7: reacting to signal 3
09-10 03:25:12.496: E/dalvikvm(4667): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
09-10 03:25:14.046: I/Process(4667): Sending signal. PID: 4667 SIG: 9
The error occurs when I change the size of the line and start to draw the matter to crash.
My question: what is wrong with these lines:
_panel.onDraw (c);
and
Shape currentGraphicObject graphicobjects.get = (i);
public void onDraw(Canvas canvas) {
for(int i = 0; i<number_of_graphicObjects; i++){
Shape currentGraphicObject = graphicobjects.get(i);
mPaint.setColor(currentGraphicObject.getrgb());
mPaint.setStrokeWidth(currentGraphicObject.getStrokeWidth());
if(currentGraphicObject instanceof FreeHand){
for (Path path : ((FreeHand)currentGraphicObject).getGraphicsPath()) {
canvas.drawPath(path,mPaint);
bitmapCanvas.drawPath(path,mPaint);
}
}
else if(currentGraphicObject instanceof Erase){
for (Path path : ((Erase)currentGraphicObject).getGraphicsPath()) {
canvas.drawPath(path, mPaint);
bitmapCanvas.drawPath(path, mPaint);
}
}
else{
canvas.drawPath(currentGraphicObject.getPath(),mPaint);
//Path pathTemp = currentGraphicObject.getPath();
//pathTemp.offset(640,0);
bitmapCanvas.drawPath(currentGraphicObject.getPath(),mPaint);
//bitmapCanvas.drawPath(path_of_shape_for_WallPaperBitmap, mPaint);
}
}
}
class TutorialThread extends Thread {
private SurfaceHolder _surfaceHolder;
private Panel _panel;
private boolean _run =false;
public TutorialThread(SurfaceHolder surfaceHolder, Panel panel) {
_surfaceHolder = surfaceHolder;
_panel = panel;
}
public void setRunning(boolean run) {
_run = run;
}
public SurfaceHolder getSurfaceHolder() {
return _surfaceHolder;
}
@Override
public void run() {
Canvas c;
while (_run) {
c = null;
try {
c = _surfaceHolder.lockCanvas(null);
synchronized (_surfaceHolder) {
_panel.onDraw(c);
//_panel.saveScreenshot();
}
} finally {
// do this in a finally so that if an exception is thrown
// during the above, we don't leave the Surface in an
// inconsistent state
if (c != null) {
_surfaceHolder.unlockCanvasAndPost(c);
}
}
}
//_panel.saveScreenshot();
}
}
public void colorChanged(int color) {
// TODO Auto-generated method stub
mPaint.setColor(color);
barva=color;
}
}
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment