Hi,
This is I'm sure a very simple thing to do and I am just missing
something but I am just starting out.  I have the main view, which has
a button.  The button brings up a second view that is supposed to show
some toast message (or, in fact do anything).  I can get everything to
work on the first view, but nothing at all to work on the second.
first view (main.xml for the layout)
public class actvSecondPage extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Button btnToast = (Button) findViewById(R.id.btnToast);
        btnToast.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                        Toast.makeText(actvSecondPage.this, "this is some 
toast",
Toast.LENGTH_LONG).show();
                }
        });

        final Button btnSecondPage = (Button)
findViewById(R.id.btnSecondPage);
        btnSecondPage.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                        setContentView(R.layout.second);
                }
        });
    }
}

Second view (second.xml for the layout)
public class actvSecond extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second);

                Toast.makeText(actvSecond.this, "this is some toast on the 
actual
second page.", Toast.LENGTH_LONG).show();
    };
}
the android.manifest.xml (in case i'm missing something there)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.SecondPage"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="3" />

    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".actvSecondPage"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
</manifest>

Can anyone help as to why what works in the first class does not in
the second?  Or, rather, that nothing at all works in the second
class?  Any help would be appreciated, thanks.
Erik

-- 
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