Button Click - Play a Sound or Nav to a Page? - android

First time poster. Im totally new to Android but I have manged to dreate a UI with two buttons. Im now attempting to find out how to hook up Button 1 to a WAV file and Button 2 to go to a second page.
Could any body please provide or link to an "easy" explanation on how to play a WAV file when clicking a button and how to open a new page when clicking the second button?
Ive found examples on the web (for the sound) but they fail to describe the full content needed such as other system "coms" etc.
Thanks all.

You've asked a general question, so the best I can do is give you a general response. For the playing sound, I'd look at the documentation that android provides for the MediaPlayer class. For launching another page, that's as simple as creating a new Intent with the activity you want to open. You'd engage both of these things by setting an OnClickListener for your buttons.

Related

MusicPlayer in Android status bar

I have an Android app which plays mp3 files. I have programmed its main functions like play/pause forward, backward buttons, manipulating by SeekBar, getting current position and so on. Now I want to make my app to continue playing even I closed my app. And when I close it, I want to appear thing like widget in status bar with basic actions (displaying app icon, track name, play/pause button). And also, I want to SeekBar work properly when I reopen my app. Can anyone help me. I'm beginner in Android Java, so it would be perfect if your answer contains steps. Thanks beforehand
I think this tutorial perfectly match your query
Android custom notification for music player Example
It think you need to read this articles:
1) https://developer.android.com/guide/components/services.html?hl=ru - this articles can help you to play music on background. It's very important component of youar app;
2) If you want to provide a widget - just see this article https://developer.android.com/guide/topics/appwidgets/index.html?hl=ru
3) If you want to show notification in status bar, see - https://developer.android.com/guide/topics/ui/notifiers/notifications.html
Also, you can find many iteresting solutions and lessons here - http://startandroid.ru/ru/uroki/vse-uroki-spiskom/164-urok-99-service-uvedomlenija-notifications.html
https://developer.android.com/training/managing-audio/index.html?hl=ru - an interesting article about music players by Google Android Developers
Best regards,
Skidan Oleg

Find hyperlink on webview and click on it

I am new on android, but i want to try to write an app for my friend. He is asking for something, who would let him record a sequence of hyperlinks and repeat it. So far i did a webview program, which shows desired web page ( actually it's wap game ) and i know how to do almost everything, except one thing.
So, i want to ask if it is possible to designate what for should program search in webview and if app find it - press on it, for example:
Webview shows a page of game with list of possible actions :
Cut tree,
Dig
and etc.
so, I want to know how i can tell program to press on "Cut tree" and then it should automaticly do it and go to pressed webpage.
I hope that someone understood me.
P.S. sorry for my bad English.
Your webview should allow for standard in-page loading of links. If you need data from the link passed to the app, then you need a javascript bridge:
Android WebView Java-Javascript bridge

Using radio buttons to select mp3 file to play

Im not necessarily asking for code but more the concept of how to achieve the following.
Im creating a bird-song app where I have a single-button that needs to play two different mp3 files as the user selects one or the other. My hope is to have the single 'play' button and then a radio button for selecting either mp3_A or mp3_B to play.
How would I go about achieving that?
THANKS!
Please try to google keywords if you are really need something most likely someone has already have tutorials on it.
Here is something off the first type on google search: site.
Oh completely forgot just use the basics for mediaplayer class like stop and open whenever a radiobutton is clicked that should solve this request of yours.
Thanks guys. This topic describes a great fix!
http://blog.nelsondev.net/?p=385

How do I put a listView inside a regular Activity?

I want to create an audio app to promote music. I want to have a regular Activity that has a listView and then a container or two to display standard information about the Artist. Music files will be inside the ListVIew with a button to play and stop the selected song. So to sum this up how should go about putting a list with buttons inside an Activity with other container? Hopefully this makes sense.
Thanks.
You should really check out this great Notepad tutorial. You create a basic Notepad, which uses a listview, and a database. If you just starting out I can tell you from experience, these tutorials are the best way to learn. There are tons of them out there :).
EDIT: While I could just give you the code to do what you want, you would learn nothing in the process :).

Working in background

Actually, I found lots of answers for my questions but this time I am totally stuck.
My question is very easy. I am building a radio streaming application for .pls streams and when the user press the home button, I want my application to continue working. I think lots of you know ebuddy and Skype or the basic media players. They are putting themselves to notification bar and you can easily reach them from this place. I tried to create a notification for my app, but when I click the icon on the notification bar, I can't reach my app. It directly opens a new version of my app and I can't control the streaming, the initial working app is no longer existing.
You may want to read the descriptions for LaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
You want to launch your Activity as singleInstance
Edit: maybe singleTask would be better.
This is the workflow you want to achieve:
All background work has to be done by a service. Implementing one is quite simple, almost as creating an activity.
There are many examples on how to do it:
http://developer.android.com/reference/android/app/Service.html
http://marakana.com/forums/android/examples/60.html
http://code.google.com/p/openmobster/wiki/AndroidService
You need the actual music playing part - or the part that should continue running in the background - to be a service, and the gui to be an activity. The notification you made should bring your activity gui to the front with a flag_activity_reorder_to_front.

Categories

Resources