Fatal signal 11というエラー
Posted: 2014年5月11日(日) 22:04
Androidプログラミングをしています。
Fatal signal 11というエラーの原因がどうしても分からなく困っています。
エラー内容
Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 31937 (om.example.aq17)
canvas.drawBitmap(bmp,0,0,mpaint);の一文を消すとエラーは起こりません。
調べてみたところFatal signal 11は「割り当てられていないメモリ領域にアクセスした」という意味らしいのでおそらく
bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.title);でbmpにうまく値が入っていないのだろうと思います。
しかしこの原因が分かりません。画像も特別大きいサイズのものを使っているわけではありませんし、画像もdrawable-ldpiフォルダに入っています。
他の画像に変えてもダメでした。
よろしくお願いします。
Fatal signal 11というエラーの原因がどうしても分からなく困っています。
//SampleView.java
package com.example.aq17;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;
public class SampleView extends View{
public Bitmap bmp;
public SampleView(Context context) {
super(context);
bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.title);
}
public SampleView(Context context , AttributeSet attrs){
super(context , attrs);
}
public SampleView(Context context , AttributeSet attrs , int defStyle){
super(context,attrs,defStyle);
}
public void onDraw(Canvas canvas){
Paint mpaint=new Paint();
canvas.drawBitmap(bmp,0,0,mpaint);
}
}
//Select_Activity.java
package com.example.aq17;
import android.app.Activity;
import android.os.Bundle;
public class Select_Activity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select_activity);
}
}
//select_activity.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.example.aq17.SampleView
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.example.aq17.SampleView>
</LinearLayout>
Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 31937 (om.example.aq17)
canvas.drawBitmap(bmp,0,0,mpaint);の一文を消すとエラーは起こりません。
調べてみたところFatal signal 11は「割り当てられていないメモリ領域にアクセスした」という意味らしいのでおそらく
bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.title);でbmpにうまく値が入っていないのだろうと思います。
しかしこの原因が分かりません。画像も特別大きいサイズのものを使っているわけではありませんし、画像もdrawable-ldpiフォルダに入っています。
他の画像に変えてもダメでした。
よろしくお願いします。