@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? 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" ...
Hey Guys, this is my first blog on Android. Hope, you will like it. In this blog i am going to show how to create a simple layout on Android in which lots of checkboxes are there and a button is present at the bottom.Many people have doubts in this as how to create a button at bottom of page in LinearLayout in Android.So, lets do this.. 1 ) First of all create Android Application Project in eclipse. 2) Go to res-> layout->activity_main.xml and copy paste the below code. <?xml version="1.0" encoding="utf-8"?> <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:background="#000000" android:orientation="vertical" > <TextView ...
Comments
Post a Comment