전역으로 값을 넘기는 문제로 질문드립니다.

 

ViewActivity 에 사용하는 xml 다음과 같습니다.

 

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"  >

    <TableRow>
        <TextView
   android:text="view...." />
       
        <Button
   android:id="@+id/finish"
   android:text="Finish"
   />
    </TableRow>
   
    <FrameLayout
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
  android:background="#0000ff" >
   
     <test.android.game.ViewDesktop
      android:id="@+id/animationView"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
        />
 
 </FrameLayout>

</TableLayout>

 

그리고 ViewDesktop 에서 public class ViewDesktop extends SurfaceView implements Callback{....}

으로 만들었습니다.

 

mainactivity 에서 변수를 public static int a 으로 만들고 ViewDesktop 에서 이 변수의 값에 접근하면 값을 못 일거 옵니다.

자바를 잠깐 하긴 했었는데요 기억에 그냥 mainsvtivity.a 하면 여기저기 사용하고 그랬던것 같은데요?

안드로이드에서는 좀 다른 가요 아니면 surfaceview 구조상 안돼는건지요 참으로 난감 합니다.

 

그리고 전역으로 접근하려고 application을 이용했는데도 역시 값이 안 넘어가네요?

 

즐거운 하루 되세요