an error will occur when executes function startActivity()

Put your problem here if it does not fit any of the other categories.

an error will occur when executes function startActivity()

Postby yaolin170 » Fri Nov 20, 2009 10:36 am

Hello everyone ,
I am a novice on Android .I downloaded a demo from net ,there are some codes like these:
if (i != null)
{
this.startActivity(i);
}
the demo can't run successfully ,I found when I am in debug mode in eclipse ,the application executes the line "this.startActivity(i);" ,an error occurs "source not found". :cry:
I feel that is weird ,I don't know why , could anyone who knows that give me the advice and tell me the reason ?
thank you very much in advance !

the detailed codes are as below :

public class AndroidGL extends Activity {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent i = new Intent(this, GLActivity.class);
switch (item.getItemId()) {
case FIRST_ID:
i = i.putExtra(GL_DRAW, GLActivity.FIRST);
break;
.....................................
if (i != null)
{
this.startActivity(i);
}
No Gods ,No Kings,Only Man!
yaolin170
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Oct 23, 2009 7:21 am

Top

Postby Kur1310 » Fri Nov 20, 2009 1:46 pm

Hey, u first check ur application's AndroidManifest.xml file...
Is there any <Activity> tag entry for ur GLActivity class..If it is not then ur application will crash.....
Check this first..
If it is not the case then let me know that...
-Kur
Kur1310
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Oct 28, 2009 10:50 am

Postby yaolin170 » Mon Nov 23, 2009 3:07 am

Kur1310 wrote:Hey, u first check ur application's AndroidManifest.xml file...
Is there any <Activity> tag entry for ur GLActivity class..If it is not then ur application will crash.....
Check this first..
If it is not the case then let me know that...



Hi Kur, you are right ,I checked the .xml file, and found I missed adding an entry for GLActivity class in it ,I added it now ,and the application can run normally ,Thank you very much for your help ! :D
No Gods ,No Kings,Only Man!
yaolin170
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Oct 23, 2009 7:21 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests