John A B Smith

Greenhorn
+ Follow
since Apr 21, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John A B Smith

Thanks a lot. Working now. 2 days spent trying to fix that.
10 years ago
Hello,

The first fix is working. I'm am sure I tried that the other day and it still didn't work.

At least this first fix will ensure my app is presentable to my module tutor and does what it says on the tin and will allow me to continue implementing the rest.

Would it be possible for you to provide a code example of your second suggestion?

I'm a week into learning the Java language from scratch separate to this project. But this project has to be finished in the next day or two and I'm not nearly competent enough to understand what you mean in the second fix.


Many thanks
10 years ago
I have amended the question because I have made some progress. Please help.
10 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

10 years ago