@Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.low : pitch = 0.5f;playit();break;
case R.id.normal: pitch = 1.0f;playit();break;
case R.id.high: pitch = 2.0f;playit();break; }
}
private void playit() { // TODO Auto-generated method stub sp = new SoundPool(1,AudioManager.STREAM_MUSIC,0); final int i = sp.load(this, R.raw.music, 0); sp.setOnLoadCompleteListener(new OnLoadCompleteListener() {
@Override public void onLoadComplete(SoundPool arg0, int arg1, int arg2) { // TODO Auto-generated method stub sp.play(i, 1,1,0,0,pitch); }
Hello Guys , how are you today? Hope you will be fine. Have you ever wondered how to write in Hindi or any other language in Android. In this tutorial we are going to see how to develop multilingual android application. Download 1) First of all, create an Android Application Project. 2) Next go to "res/layout/activity_main.xml" and create a TextView there. The code looks like activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActiv...
Hello Guys, how are you today? Its super Friday. Hope having a good day. Today we are going to see how to use MediaPlayer for for performing basic operations like play, pause, stop in Android. So lets get started. Download 1) First of all, create an Android Application Project. 2) Then go to "res/layout/activity_main.xml" and create 3 buttons there play, pause and stop. So the code looks like. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" ...
Hello Guys , how are you today? Its super Friday. In this blog e are going to see how to make an image slideshow with button and music controls in Android. So ,lets get started. Download 1) First of all create an Android Application Project. 2) Go to "res/layout/activity_main.xml" and create two image buttons there. This code looks like <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" android:background="@drawable/costume1" ...
Comments
Post a Comment