I am working on a game app for my granddaughter. It has several
activities. I was working on the hangman game activity and decided to
add some animation. Afterward, I find the activity forces closed. I
have it defined in the androidmanifest.xml file. I even reverted to a
prior version of the activity that was working fine, but it still
forces close. Note the line that has the comment  "// Crashes here." I
have a breakpoint set at that line, but execution stops at this point.

Any advice is appreciated. Source code for game menu activity shown
below.

package com.AE.HollySpelling;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class GameMenu extends ListActivity  {
        /** Called when the activity is first created. */
        String[] items={"Spelling test",
                        "Scramble",
                        "Hangman",
                        "Exit"};
        Intent intent = getIntent();

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.games);
        setListAdapter(new ArrayAdapter<String>(this,
                                R.layout.listrow, R.id.label,
                                items));
        Intent intent = getIntent();
    }
    @Override
    public void onListItemClick(ListView parent, View v,
                int position, long id) {

                switch(position)
                {
                        case 0:
                                intent = new Intent(v.getContext(),
                                        VoiceManager.class);
                                        startActivityForResult(intent, 0);
                                break;
                case 2:
                        intent = new Intent(v.getContext(),
                                        Hangman.class);
                                startActivityForResult(intent, 0); // Crashes 
here.
                        break;
                case 3:
                        finish();
                        break;
                }
    }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to