posted 9 years ago
Hello,
(I've amended my question because I have made some progress)
This is my first post and first venture onto a forum about Android Development.
I've been working on this small android app for the last week and half and have done about as much as possible without anyone's help so far via online tutorials.
I have a specific issue now which I have not been able to resolve and I've been reading and trying different things to get it working since yesterday.
I have a main activity called GuitarActivity.java and its layout activity_guitar.xml.
There is a row of buttons which pull in a fragment called guitar_tune_01.xml
The fragment has a row of buttons which need to play a different sound each.
I have implemented the fragment code into the main activity GuitarActivity.java
I am getting one last error which I really need someone to help me fix.
Error is on line 38 and all recurring instances: MediaPlayer mp = MediaPlayer.create(getApplicationContext(),
Error says
rename in file (ctrl+2, r)
and
cannot make a static reference to the non static method getapplicationcontext from the type contextwrapper
MyFragment1 is a static class, and I can't reference the non-static method from there. I need to move the fragment to the outer scope (its own class file) and remove the static modifier on the class declaration, and that should do it.
This was from someone who was trying to help me but is over my head.
Please help.
Many thanks, Jo
GuitarActivity.java
activity_guitar.xml
fragment_guitar_tune_01.xml