Invalid File name???

All your problems with Audio, Video and Images.

Invalid File name???

Postby NoobDroid » Fri Feb 25, 2011 5:52 pm

Hi,
I have one problem with my first android app and i hope anyone can help me.(I didnt find some in the search function :) )
Here is some source code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final MediaPlayer mp = MediaPlayer.create(this,R.raw.Happy_Birthday);
  2.         Button button=
  3.                 (Button)this.findViewById(R.id.button1);
  4.         button.setOnClickListener(new View.OnClickListener()
  5.         {
  6.                
  7.                 public void onClick(View v){           
  8.                                 mp.start();
  9.                 }
  10.                
  11.                
  12.                
  13.         });
  14.     }
  15.  
  16. }
  17.        
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

The problem is the mp3 file "Happy_Birthday",
there eclipse shows the error "Happy_Birthday cannot be resolved or its not a field."
and log shows error "Invalid file name: must contain only [a-z0-9_.]"
but the file is in the folder res/raw and I made a resource in the manifest.


Pls Help me

NoobDroid
NoobDroid
Freshman
Freshman
 
Posts: 6
Joined: Thu Feb 24, 2011 9:00 pm

Top

Re: Invalid File name???

Postby mitutitu » Fri Feb 25, 2011 8:31 pm

Hello NoobDroid,
The problem is in the naming convention. In android, resource file names can not be in capital letters.

So your mp3 file name should be :
happy_birthday
instead of
Happy_Birthday


hope it will help you :)

Thanks,
mitu
Android is awesome!
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Re: Invalid File name???

Postby NoobDroid » Sun Feb 27, 2011 2:44 pm

thanks ,it helped a bit but there is an error which says "happy_birthday cannot resolved or is not a field

thanks for replies
NoobDroid
Freshman
Freshman
 
Posts: 6
Joined: Thu Feb 24, 2011 9:00 pm

Re: Invalid File name???

Postby NoobDroid » Sun Feb 27, 2011 3:54 pm

ok thanks so muuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuch now it works xDDDDDDDDDD


THANK U VERY MUCH
i love u

NoobDroid
NoobDroid
Freshman
Freshman
 
Posts: 6
Joined: Thu Feb 24, 2011 9:00 pm

Re: Invalid File name???

Postby mitutitu » Sun Feb 27, 2011 4:25 pm

you are welcome ! :)
Android is awesome!
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 17 guests