안녕하세요. 우선 아래와 같이 파일을 만들었습니다.
MainApp에서는 sendmessage하니까 메시지을 잘보내는데 ImageView에서 MainApp객체를 얻어와서 sendmessage하니까 메시지 값이 넘어가지를 않습니다.
Null익셉션 오류가 뜨면서 어플이 비정상 종료가 됩니다.
무엇이 문제인지 고수님들 부탁드립니다.
제가 초보라 자세한 설명좀 부탁드릴께요.

MainApp.java
public class MainApp extends Activity 
{
    private BluetoothSer mService = null;

    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    }
 
    public void onStart() 
    {
        super.onStart();
        
        TestButton = (ImageButton)findViewById(R.id.testButton);
        indirect_Button.setOnClickListener(new View.OnClickListener() {    
          public void onClick(View v) {
            sendMessage(mBuffer);
         }    
      });
    }

    public synchronized void onResume() 
    {
        super.onResume();

        mService.connect(device);
    }


    public void sendMessage(byte[] message) 
    {        
        mService.write(message);
    }    
}


ImageView.java
public class ImageViewRotate extends View
{

   private MainApp mMainApp = null;
   byte[] mBuffer = new byte[1024];


    public ImageView(Context context, AttributeSet attrs) 
    {   
      super(context, attrs);            
      mMainApp = new MainApp();
    }

    protected void onDraw(Canvas canvas) 
    {
       // 이렇게 하니까 메시지를 못보내네요...
        mMainApp.sendMessage(mBuffer);
    }

  public boolean onTouchEvent(MotionEvent event) 
  {
    invalidate();
    return true; 
  }
}



BluetoothSer.java (블루투스 체팅 프로그램 소스 그래도 사용)
    public void write(byte[] out) 
    { 
        ConnectedThread r;
        r.write(out); 
    } 

main.xml
<AbsoluteLayout 
 android:id="@+id/AbsoluteLayout02" 
 android:layout_width="wrap_content" 
 android:layout_height="fill_parent"
 >  
 <view class="kr.android.Display.ImageView"    
     android:id="@+id/ImageView"  
     android:layout_width="300px"  
     android:layout_height="330px"
     android:layout_x="10px" 
  android:layout_y="112px" 
  android:clickable="true"    
     />               
</AbsoluteLayout>