About
I’m a software engineer, actually working in Financial IT inLondon.
I really enjoy programming, but it’s sometimes frustrating that the fruit of so much hard work can’t have some physical impact…
With robotics I really enjoy the “completeness” that it offers for an engineer : you have the mechanical challenge to built your robot, the electronics skills needed for the circuitry and finally the programming of the AI (which is often the part I never finish, mostly because I must be having enough of it during work hours
).
dan
dan,
i need your email so i can talk to you directly, without posting to yor blog, you mind?
James
contractorwolf.wordpress.com
Hello,
I have a question please. I have a littel problem with playing sound using android.
In my application I have 3 class A, B and C. the class A extends Activity, and in his constructor will create an instance of the class B. The class B is an extends of theclass C.
My application is simple. when class B get a specific result, he have to make a sound( no human interact, just it’s calculate a result for example i++ ; when he got i = 10 he make a sound “bip “). But the only way, I succeed in making a sound is when I click on a menu item, from the class A ( using the package android.media.MediaPlayer ). What I want is the class B who be able to use that method. when I put the same code in B, I got this error ” The method create(Context, int) in the type MediaPlayer is not applicable for the arguments ” this is
the code of the method :
public void objFound() {
try
{
MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.button);
mediaPlayer.start();
}
catch(Exception ex)
{
//logInfo(“Music failed: ” + ex.getMessage());
}
}
}
What I need, is to find a way to make that sound played directly from
the class B ( it’s the best for me ) or find a way to call the method in class A
from the class B.
Note : I tried to make an instance of the class A in B, that doesn’t
work ( when I send the application to my mobile phone ” Huawei U8180
android 2.2.2 ” its crashed).
I tried also to make my method as a static method in class A.
But their is a problem with the ” MediaPlayer.create(this,
R.raw.button); ” it can’t be static.
Thanks for your help in advance.
Hi,
This is really an Android specific question, nothing to do with physical computing, electronics or even with the IOIO board… I think you’re best bet for an answer would be on the Android forums…
I’ll try however to quickly answer it, as it seems a reasonably simple issue.
Your MediaPlayer constructor needs an Activity as the 1st parameter ( MediaPlayer.create(this, R.raw.button); ). So this is why you get the “The method create(Context, int) in the type MediaPlayer is not applicable for the arguments” if you simply move that call in class B, which is NOT an Activity from what I understand.
There are several solutions to this, one of which would be to pass the instance of A to the B contructor (you say A creates B), store it as let’s say Activity _parent, and then inside B, when Calling MediaPlayer.create(_parent, ….) rather than “this”.
Hope this helps, Dan
hi,
Thank you a lot for your help. In fact, the solution is to send the class A Context’s to class B ( using the constructor of class B ). then I will used with the method directly
Context cont;
B (Context contexte ){
cont = contexte ;
}
public void objFound() {
try
{
MediaPlayer mediaPlayer = MediaPlayer.create(cont, R.raw.button);
mediaPlayer.start();
}
catch(Exception ex)
{
//logInfo(“Music failed: ” + ex.getMessage());
}
}
}
Thanks you again my friend
sincerely
Saber
Hello,
I’m very interested in robotic field too. Actually I’m working on a robot using an android phone. My question is about the IOIO. Did IOIO work with Huawei U8180 ( android 2.2.2 ) ( URL http://huaweidevice.co.in/Products/UpcomingProducts/Huawei-Gaga-U8180.php ) ???
Thanks in advance.
Hi,
I’d be happy to see more details about the exact robot you’re working on…
As for the specific phone you’re asking about, I have no idea …
You should maybe check this thread on the IOIO board group.
Dan
Hello,
Thank you a lot. When I will finish my personal page on the net I will send you the URL so you will be able to see more details
have a nice day .
Saber
Hi,,,, I was hoping you might be able to help me… Im trying to figure out what diode sits i the R700 receiver right next to the battery intake…. i burnt my out, and i was hoping to be able to figure out what diode it is since i have access to electrical components and would be able to fix it myself..
Thanks in advance,
kristjan
226A sourface mount diode
There’s also this code below: R06XM, which I don’t know what stands for…
hope this helps,
dan