Hi Guys ,
I'm new to android development i got stuck at one problem and dono wat
how to fix it
The problem i'm facing is that
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.
Please find the Screen1 code ::::
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));
}
}
}
Please help me to fix this problem
Regards,
Sam
--
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