File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .lenovo .basicphrases ;
2
+
3
+ import android .media .MediaPlayer ;
4
+ import android .support .v7 .app .AppCompatActivity ;
5
+ import android .os .Bundle ;
6
+ import android .util .Log ;
7
+ import android .view .View ;
8
+ import android .view .animation .Interpolator ;
9
+
10
+ public class MainActivity extends AppCompatActivity {
11
+
12
+ @ Override
13
+ protected void onCreate (Bundle savedInstanceState ) {
14
+ super .onCreate (savedInstanceState );
15
+ setContentView (R .layout .activity_main );
16
+ }
17
+
18
+ public void buttonTapped (View view )
19
+ {
20
+ int id = view .getId ();
21
+ String ourid ="" ;
22
+
23
+ ourid = view .getResources ().getResourceEntryName (id );
24
+
25
+ int resourceId = getResources ().getIdentifier (ourid ,"raw" ,"com.lenovo.basicphrases" );
26
+
27
+ MediaPlayer mplayer = MediaPlayer .create (this ,resourceId );
28
+ mplayer .start ();
29
+ Log .i ("button tapped" , ourid );
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments