Sunday, September 4, 2011

[android-developers] Re: Help needed on BUtton CLick

Hi Michael ,

i was able to create two screen using Intent but i'm having a problem

I have Screen1,Screen2,Screen3

In Screen1 i have two button, were clicking the button1 will take to
the second screen and clicking the button2 will take to the third
screen.

When i click on the first button it takes me to the second screen ,
but when i click on the button2 it force closes..

package com.sai.android;

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

public class Screen1 extends Activity implements OnClickListener{
/** Called when the activity is first created. */

Button b1;
Button b3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen1);

b1=(Button)findViewById(R.id.button1);
b3=(Button)findViewById(R.id.button3);
b1.setOnClickListener(this);
b3.setOnClickListener(this);

}


@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(b1==v){
startActivity(new Intent(Screen1.this,Screen2.class));
}

else
{
startActivity(new Intent(Screen1.this,Screen3.class));


}

}


}

On Sep 4, 12:45 am, Michael Banzon <mich...@banzon.dk> wrote:
> On Sat, Sep 3, 2011 at 7:46 PM, sam <hotdude...@gmail.com> wrote:
> > How do i call the ImageGallery class after theButtonis clicked.
>
> Hey,
>
> You need to start the another Activity using an Intent... if this
> makes no sense try to google it ;o)
>
> --
> Michael Banzonhttp://michaelbanzon.com/

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate