I am following this code on the andriod developer site. This code shows the picture in a grid. What I want to do now is to play different sands every time the user clicks on the image. How can I do this?
Crate on Public Zero (Bundle Saved Instantstate) {super.onCreate (savedInstanceState); SetContentView (R.layout.main); Find Gridview Gridview = (Gridview) VVBID (RIDGDView); Gridview.setAdapter (New ImageAdapter (this)); Gridview.setOnItemClickListener (New OnItemClickListener) {Public Zero onItemClick (AdapterView & LT;? & Gt; Parents, View V, Integer Status, Long ID) // // MyIntent = Null, makes some sound, then (position = = 0) {// Play ... // Media Player Sound = Media PlayerCredits (this, R.O.A.LIFF); // Voice Start ();} If (Position == 1) {Toast. Make Text ( Test. This, "" + "ba", toast.LnnGHIHORT) Show (); // want to play sound here}}}); } When I add this code: I get a compilation error
Method type (reference, INS) is not applicable for MediaPlayer type Logic (New AdapterView.OnItemClickListener () {}, integer)
if (condition == 0) {MediaPlayer sound = MediaPlayer.create (this, R.raw.alif) ; Sound.start (); } "itemprop =" text "> button.setOnClickListener (New View.OnClickListener () {@Override}
Comments
Post a Comment