我的代码如下:
- Java code
public class Graphics extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new GraphicsView(this)); } static public class GraphicsView extends View { Paint cPaint =new Paint(); Path circle = new Path(); private static final String QUOTE = "New is the time for all" + "good men to come to the aid of their country."; public GraphicsView(Context context) { super(context); Canvas canvas = new Canvas(); onDraw(canvas); } @Override protected void onDraw(Canvas canvas) { circle.addCircle(150, 150, 100, Direction.CW); canvas.drawPath(circle, cPaint); canvas.drawTextOnPath(QUOTE, circle, 0, 20, cPaint); } } }
程序不报错但是在运行时莫名奇妙的退出了??
日志如下:
10-25 14:31:01.699: INFO/ARMAssembler(61): generated scanline__00000177:03515104_00001A01_00000000 [ 73 ipp] (98 ins) at [0x463760:0x4638e8] in 1175641 ns
10-25 14:31:01.939: INFO/ActivityManager(61): Displayed activity com.android.launcher/.Launcher: 63765 ms (total 63765 ms)
10-25 14:31:04.919: DEBUG/dalvikvm(111): GC freed 2185 objects / 116328 bytes in 121ms
10-25 14:31:07.079: INFO/ActivityManager(61): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.wiscom.pzq.Graphics/.Graphics }
10-25 14:31:07.269: INFO/ActivityManager(61): Start proc com.wiscom.pzq.Graphics for activity com.wiscom.pzq.Graphics/.Graphics: pid=235 uid=10036 gids={}
10-25 14:31:07.719: DEBUG/ddm-heap(235): Got feature list request
10-25 14:31:07.919: INFO/ARMAssembler(61): generated scanline__00000177:03515104_00000001_00000000 [ 73 ipp] (95 ins) at [0x3dad98:0x3daf14] in 2720350 ns
10-25 14:31:08.079: INFO/ARMAssembler(61): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3daf18:0x3db024] in 539182 ns
10-25 14:31:08.479: INFO/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-25 14:31:08.479: INFO/DEBUG(28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
10-25 14:31:08.479: INFO/DEBUG(28): pid: 235, tid: 235 >>> com.wiscom.pzq.Graphics <<<
10-25 14:31:08.479: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr 00000028
10-25 14:31:08.479: INFO/DEBUG(28): r0 00000000 r1 0012a684 r2 00000000 r3 0012a684
10-25 14:31:08.479: INFO/DEBUG(28): r4 0012a718 r5 0012a6c4 r6 00000000 r7 00000000
10-25 14:31:08.489: INFO/DEBUG(28): r8 beaeb870 r9 00000000 10 beaeb8d0 fp 0012a650
10-25 14:31:08.489: INFO/DEBUG(28): ip 00000000 sp beaeb7d8 lr 00000000 pc ac065288 cpsr 60000010
10-25 14:31:08.629: INFO/DEBUG(28): #00 pc 00065288 /system/lib/libskia.so
10-25 14:31:08.639: INFO/DEBUG(28): #01 pc 00066b14 /system/lib/libskia.so
10-25 14:31:08.649: INFO/DEBUG(28): #02 pc 00064084 /system/lib/libskia.so
10-25 14:31:08.649: INFO/DEBUG(28): #03 pc 00040e08 /system/lib/libandroid_runtime.so
10-25 14:31:08.659: INFO/DEBUG(28): #04 pc 0000f1f4 /system/lib/libdvm.so
10-25 14:31:08.659: INFO/DEBUG(28): #05 pc 00040dc6 /system/lib/libandroid_runtime.so
10-25 14:31:08.659: INFO/DEBUG(28): code around pc:
10-25 14:31:08.659: INFO/DEBUG(28): ac065278 e1d4e2f4 e1d472f6 e5946004 e197200e
10-25 14:31:08.670: INFO/DEBUG(28): ac065288 e5969028 e596a024 0a00002e e59db00c
10-25 14:31:08.670: INFO/DEBUG(28): ac065298 e2848028 e1a0c008 e8bb000f e8ac000f
10-25 14:31:08.670: INFO/DEBUG(28): code around lr:
10-25 14:31:08.670: INFO/DEBUG(28): stack:
10-25 14:31:08.670: INFO/DEBUG(28): beaeb798 44e910d0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)