thanks, it worked after refactoring/renaming the activity it didn't change in the manifest. I changed it again and it worked
On Mon, Jan 25, 2016 at 7:40 AM, sardar khan <[email protected]> wrote: > have you declare the activity in the manifest..?? > > On Mon, Jan 25, 2016 at 2:59 AM, Zaher abou khashbeh < > [email protected]> wrote: > >> I have created 3 activities >> MainActivity has 2 layouts in it, on setOnClickListener it starts the >> other activity >> >> the first onClickListener works find and it starts the 2nd activity. but >> the second onClickListener crashes the application when I click on that >> layout, eventhough I copied and pasted the code from the first >> onClickListener. >> >> here is the code from the MainActivity >> >> public class MainActivity extends AppCompatActivity { >> >> @Override >> protected void onCreate(Bundle savedInstanceState) { >> super.onCreate(savedInstanceState); >> setContentView(R.layout.activity_main); >> >> RelativeLayout twopoints = (RelativeLayout) >> findViewById(R.id.layout_twopoints); >> twopoints.setOnClickListener(new View.OnClickListener() { >> @Override >> public void onClick(View v) { >> Intent line2points = new Intent(MainActivity.this, >> eqn2points.class);//this one works fine >> startActivity(line2points); >> } >> }); >> >> RelativeLayout lines = (RelativeLayout) >> findViewById(R.id.layout_relativeline); >> lines.setOnClickListener(new View.OnClickListener() { >> @Override >> public void onClick(View v) { >> Intent line2line = new Intent(MainActivity.this, >> eqn_para_perp.class);// this one crashes >> startActivity(line2line); >> } >> }); >> >> } >> } >> >> >> >> >> >> this is the required activity that crashes >> >> >> >> public class eqn_para_perp extends AppCompatActivity { >> >> @Override >> protected void onCreate(Bundle savedInstanceState) { >> super.onCreate(savedInstanceState); >> setContentView(R.layout.activity_eqn_para_perp); >> >> RelativeLayout para = (RelativeLayout) findViewById(R.id.parallel); >> para.setOnClickListener(new View.OnClickListener() { >> @Override >> public void onClick(View v) { >> Intent line2point = new Intent(eqn_para_perp.this, >> parallel_line.class); >> startActivity(line2point); >> } >> }); >> >> RelativeLayout perp = (RelativeLayout) >> findViewById(R.id.perpendicular); >> perp.setOnClickListener(new View.OnClickListener() { >> @Override >> public void onClick(View v) { >> Intent line2point = new Intent(eqn_para_perp.this, >> perpendicular_line.class); >> startActivity(line2point); >> } >> }); >> >> } >> } >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/android-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/android-developers/8ff39d68-afec-44ff-bf67-fbf1268b9369%40googlegroups.com >> <https://groups.google.com/d/msgid/android-developers/8ff39d68-afec-44ff-bf67-fbf1268b9369%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Android Developers" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/android-developers/rTtt6Exufvo/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/android-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-developers/CABHzXARzsXMGjqVeoe9hXiCwM8VYLRqxhDuhng%3DgMaeWjN3Ybw%40mail.gmail.com > <https://groups.google.com/d/msgid/android-developers/CABHzXARzsXMGjqVeoe9hXiCwM8VYLRqxhDuhng%3DgMaeWjN3Ybw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/CALMfa8kEo1Vayj99-h0d2AHvWNEOcA%2BsqwN8Sv3QUvGrxW8%2B_w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

