私はEclipseで(Windowsで)アンドロイドゲームを作ろうとしています。エミュレーターと電話の両方でプログラムを実行すると、nulpointerexceptions と classcastexceptions が発生し続けます。それぞれ独自のxmlレイアウトを持つ2つのクラス(アクティビティ)があります。主な活動は完全に実行されます。ただし、2番目のアクティビティを次のように起動すると:
final Intent i = new Intent(this, Arrowscreen.class);
...
startActivity(i);
前述の例外があります。見つからないソースを常に指します。 WindowsのEclipseでソースをステップスルーする方法はありますか? http://source.android.comを見てきましたが、Windows には解決策がないようです。cygwin の Linux の指示に従おうとしましたが、うまくいかないようです (できれば Windows で作業したいと思います)。
私はまだアンドロイド開発に慣れていないので、何か重要なものを見逃しているかもしれません。このマニフェスト宣言に問題はありますか?:
<activity android:name=".Arrowscreen"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.RUN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
コード サンプル全体は長くなるため掲載を控えますが、「postDelayed」を使用してタイマーのメイン ループに加速度計、GPS、ランナブルを使用していることをお伝えします。GPSの細かい位置の許可もマニフェストにあります。私は立ち往生しているので、どんな助けでも大歓迎です。ありがとう!
編集:以下は、実行時例外が発生するコードの一部です
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.arrow);
img=(ImageView)findViewById(R.id.ArrowBackground);
arrow1=(ImageView)findViewById(R.id.turningArrow);
GPSx=(TextView)findViewById(R.id.textView1);
GPSy=(TextView)findViewById(R.id.textView2);
MGNTx=(TextView)findViewById(R.id.textView3);
MGNTy=(TextView)findViewById(R.id.textView4);
angle = 0;
lastAngle = 0;
arrowAngle = 0;
mValues[0]=0; mValues[1]=0; mValues[2]=0;
//mStartTime = System.currentTimeMillis();
mHandler.removeCallbacks(UpdateArrow);
mHandler.postDelayed(UpdateArrow, 400);