Skip to content

Android: Counter-Strike 1.6 SoundBoard released

by mat on January 15th, 2010

A soundboard is a very simple application to make, and I was given the idea to make a counter-strike 1.6 version by a friend. It seemed like a good idea as no one had made one yet, and it’s quite hard to find something that hasn’t already been done before.

counter-strike 1.6 soundboard promo image

counter-strike 1.6 soundboard

The buttons are aligned in a grid view, with the buttons made transparent so that the background can be seen.

screenshot of counter-strike 1.6 soundboard android application

screenshot of counter-strike 1.6 soundboard

another screenshot of counter-strike 1.6 soundboard android application

screenshot of counter-strike 1.6 soundboard

I am very pleased with the final look of the app, however it was getting poor reviews due to people wanting to save the sounds for use as a ringtone. To alleviate this problem I have updated the app to have this option as a context menu avaliable by long pressing on a button. This will then save the file on the sd card and update the mediastore to tell android a new ringtone and notification has been added.

The code to load a ringtone into android from an application is shown below. If you see any problems with this code, or have an improvements please let me know!

File k = new File(path, filename);

ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
values.put(MediaStore.MediaColumns.TITLE, filesnames[pos]);
values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/wav");
values.put(MediaStore.Audio.Media.ARTIST, "cssounds ");
values.put(MediaStore.Audio.Media.IS_RINGTONE, true);
values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
values.put(MediaStore.Audio.Media.IS_ALARM, true);
values.put(MediaStore.Audio.Media.IS_MUSIC, false);

//Insert it into the database
this.getContentResolver().insert(MediaStore.Audio.Media.getContentUriForPath(k.getAbsolutePath()), values);

Ratings, reviews, feedback and feature requests are most welcome.

Download Link

Android Market Link (For android phones)

  1. Jason permalink

    Hello Mat,

    I have been admiring your soundboard app and wondering just how you got the context menu, etc set up to allow the saving of tones. I am working on an idea for an app of my own and cannot get it to work. There is not enough src in your post for me to figure out what should be done beforehand. Could I see the src for the entire class?

    Any help would be greatly appreciated :)


  2. Jason,

    Thanks. I created the buttons dynamically and added them to a gridview. For each of them I use “registerForContextMenu(btn);” then I added the options to the context menu

        public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {
    	super.onCreateContextMenu(menu, v, menuInfo);
    		menu.setHeaderTitle("Ringtone Actions");
    		menu.add(0, v.getId(), 0, "Save as Ringtone");

    And then set the even to occur on the selection of this context menu.

    	public boolean onContextItemSelected(MenuItem item) {
    	int x = item.getItemId();
    		return true;

    That should probably be enough code to explain it? I might post a short tutorial on it as I would probably do a better job of explaining it then. Hope this helps.


  3. Jason permalink

    Excellent! I had actually figured that piece out just before reading this post :)

    For the resource > ringtone part, did you write to the sdcard before setting the ringtone or is there a way to inject the tone straight in?

    I am trying to figure out that entire process right now…

    Thanks for your reply :)

  4. Jason permalink

    I figured it all out!
    Thanks again for your tips along the way :)

  5. Yes, I saved it to the SD card also.
    I placed it in /sdcard/media/audio/ringtones/

    Glad you got it working, let me know when your app is out so I can try it.

  6. Steve permalink

    I am having trouble getting this working… How does the app know what file it is copying from? I am looking to copy from a package .wav in my raw file.
    Any ideas or more code you could share?

  7. @steve, @jason posted an example which is more complete showing how to save the file and then register as a ringtone:

  8. Chris permalink

    I’m making a sound board for a game. I liked how you had your buttons. I wanted users to see my background so i set the button transparencies to ‘0’, but how did you get the look of yours? Did you use a drawable source?

  9. I created an xml file for the button which uses png images with transparency, I don’t think you need to set anything special for the button then. Let me know if you need an example and I’ll whip something up for you. Also let me know when you release your app and I’ll have a play with it :)

  10. Chris permalink

    I acturally figured how to do it.. thank you though.. my main issue is trying to set up the option to let users save as ringtones and such.. main problem is my buttons get created from an adapter..

    acturally the first version of the app is out there, its a Call of Duty MW2 soundboard…

  11. Yes, my buttons are setup in the same manner. I’m planning a writing brief tutorial on it, but I have lots of work at the moment. I will check out your app shortly!

  12. Chris permalink

    ya I’m working to re-do the current app with an update, it’s changed alot since that one was published…

    so where about did u involve the ringtone? I tried to work with it in the button adapter but seems it only wants to work when its extended from Activity…

  13. I used “class ButtonAdapter extends BaseAdapter” which then calls a custom OnClickListener “class MyOnClickListener implements OnClickListener”. Then using this custom OnClickListener to call my ringtone function.

  14. Chris permalink

    think you should put up a full soundboard tutorial LOL

  15. Chris permalink

    just updated the app if you still wanted to check it out.. thanks

  16. Yeah, I checked it out the tabs are nice, the button gets horribly pixelated on the last two tabs as they only contain on item though. You make much from the adverts?

  17. Chris permalink

    eh.. not a great deal… lol…

  18. Chris permalink

    i almost have my ringtone/notifications working.. but when i long click it force closes.. dang im soo close LOL

  19. mat I have been looking at all of the code to get save to ringtone and notifications working and I can only get the context menu working… could you please email me so I can ask you a few questions??? I would really appreciate that sooo much!!

  20. lol thts cool app

  21. great work. em big fan of Counter Strike :D

  22. m3n0R permalink

    Hi again @mat!
    I’m here to make you one more question. I finished my Android project, but Now I’m working improving it in Design and programatically correct.

    I would like to know if you could send me the buttons you did for your scoreboard, or, how can I create them, because I have download a transparent button from google, and when I open it with draw9patch i can’t do anything :S

    If you don’t want to give me your images I will understand. In that case, could you tell me the measure (width and high) of the buttons ? (for normal view and landscape view too…)

    Thank you so much guy! gl!

  23. Isa permalink

    This is an awesome article regarding the soundboard…Why didn’t anyone think of this before. I also found this great software download where you can get Counterstrike for free,

    Enjoy guys!

  24. This line:

    values.put(MediaStore.MediaColumns.TITLE, filesnames[pos]);

    Where is filesname[pos] pulling from? Some type of array I know. This is one of the last steps in the process to get my soundboard working.

  25. Just an array of strings corresponding to the array of sound files I was using.

  26. You’re so cool! I don’t think I’ve read anything like that before. So nice to discover somebody with a few genuine thoughts on this subject matter. Seriously.. thanks for starting this up. This site is something that is required on the web, someone with a bit of originality!

Trackbacks & Pingbacks

  1. » Portal Soundboard for Android released

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS