Starting activity(android app development) -


i want start activity mainactivity. here's mainactivity:

public class mainactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         toast.maketext(getapplicationcontext(), "hello world", toast.length_long).show();         setcontentview(r.layout.activity_main);          intent intent = new intent(this, intent.class);          startactivity(intent);     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }  } 

and here's intent class want start:

public class intent extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.intent1);         toast.maketext(getapplicationcontext(), "hi", toast.length_long).show();     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }   } 

but program crashes in runtime. why?

you have named activity want start intent , initializing intent object android core package. of course, there namespace collision 1 of these classes imported , not desired behavior.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -