기본 콘텐츠로 건너뛰기

1월, 2017의 게시물 표시

Android, SoundPool, play wav

SoundPool sPool = new SoundPool( 1 , AudioManager. STREAM_MUSIC , 0 ); final int intRaw = sPool .load( this , R.raw. sample1 , 1 ); Button btn = (Button)findViewById(R.id. button1 ); btn.setSoundEffectsEnabled( false ); btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { sPool .play( intRaw , 1 , 1 , 0 , 0 , 1 ); } }

iOS, Toast

NSString * message = @ "Some message..." ; UIAlertView * toast = [[ UIAlertView alloc ] initWithTitle : nil message : message delegate : nil cancelButtonTitle : nil otherButtonTitles : nil , nil ]; [ toast show ]; int duration = 1 ; // duration in seconds dispatch_after ( dispatch_time ( DISPATCH_TIME_NOW , duration * NSEC_PER_SEC ), dispatch_get_main_queue (), ^{ [ toast dismissWithClickedButtonIndex : 0 animated : YES ]; }); ref :  http://stackoverflow.com/questions/18680891/displaying-a-message-in-ios-which-has-the-same-functionality-as-toast-in-android