Hi everyone, I am relatively new to Android programming. Recently,
when I am doing this lab sheet about preserving state information
MotoDev studio said that my the type that I am declaring cannot be
resolved. Below are some parts of the code:

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

        Log.d("StateInfoLab", "onCreate");

        final Button btnSave = (Button) findViewById(R.id.saveButton);
        final Button btnLoad = (Button) findViewById(R.id.loadButton);
        ...
        .....
        btnLoad.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                // TODO Auto-generated method stub
                                mTts.speak(btnLoad.getText().toString(), 
TextToSpeech.QUEUE_FLUSH,
null);
                                Toast.makeText(getBaseContext(), "Retrieved: '" 
+ str + "'",
Toast.LENGTH_SHORT).show();
                                mTts.speak("Retrieved: " + str, 
TextToSpeech.QUEUE_FLUSH, null);
                        }
                });

        CustomInfo CI = (CustomInfo)
getLastNonConfigurationInstance();
        if(CI != null)
                str = "'" + CI.str + "' saved on " + CI.dateSaved;
    }

    public Object onRetainNonConfigurationInstance(){
        CustomInfo CI = new CustomInfo();
        CI.str = str;
        CI.dateSaved = new Date().toString();
        return (CI);
    }

I created another file under the same package called CustomInfo which
look like this:

public class CustomInfo{
        String dateSaved;
        String str;
}

The IDE said that the 'CustomInfo could not be resoled to a type'.Can
someone enlighten me as to how to resolve this problem? Appreciate it!

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

Reply via email to