Hi,
I just started programmind an application using Eclipse for Android.
I am creating 2 screens.

1st screen:
Has a text and
a button which onClick --> takes you to the 2nd screen.

2nd screen:
Has a text and
a button which onClick -- > takes you to the 1st screen.

just like NEXT and BACK.

But somehow i keep getting "Application Simple application has stopped
unexpectedly." Force Close.


My code:Simple.java

package com.vijay.simple;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class Simple extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    Button b1 = (Button) findViewById(R.id.button_id1);
    b1.setOnClickListener(buttonListener1);

    Button b2 = (Button) findViewById(R.id.button_id2);
    b2.setOnClickListener(buttonListener2);
    }

    private OnClickListener buttonListener1 = new OnClickListener(){
        public void onClick(View v1){
                setContentView(R.layout.main_2);
        }
    };

    private OnClickListener buttonListener2 = new OnClickListener(){
        public void onClick(View v2){
                setContentView(R.layout.main);
        }
    };

}




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

Reply via email to