0

Ok well this is my first time posting on here and well I'm still pretty new with android programming.

Issue: I am trying to play a sound routine using a seperate class from my widget.class For the life of me I cannot get this to work. Basically the user clicks a button on the widget and the result is a sound file being played. (Well that's the desired result anyways) I have tried running Toast tests in the seperate.class under onItemClick and I get no result, when I try to run it as an activity I get a blank layout but toast shows a response under the onStart() event.

Request: Can someone give me a short bit of code, perhaps a template of what I need to have in the seperate class and under which even it needs triggered?

Joey
  • 142
  • 2
  • 14

2 Answers2

1

Little offtopic, but

wow, you went through the same stuff as I did :) Same story, completely, with the toast's and the blank layouts and stuff. Except I wasn't trying to get audio from widget, but anyway. I managed to get that toast thing done by adding an xml file which contains nothing, but has a completely transparent theme, then showing the toast in my click-activity which uses that xml for it's layout, and lastly, calling finish() on that activity. Thought you'd maybe want to know :')

Revolutionair
  • 760
  • 6
  • 19
1

Here are some links for you to have a look at:

EDIT

Community
  • 1
  • 1
dave.c
  • 10,910
  • 5
  • 39
  • 62
  • I understand how to play a sound file... as I am not asking how to play a sound file directly from a view persay... I want to be able to click a widget and use my pendingintent to initialize an external class file in my project to have "it" play the sound file. I am not able to figure out how to play the sound or process info in that external class onevent ... basically click "widget" home screen button, load class, trigger event, play sound... without having a blank view popup with it. The links you provided have been visited in the past an provide "zero" widget/service control information. – Joey Jan 29 '11 at 02:28
  • @Joey added some more links. Google is [your](http://www.google.com/search?q=site%3Astackoverflow.com+mediaplayer+service+widget) [friend](http://www.google.com/search?q=android+mediaplayer+service+widget) – dave.c Jan 29 '11 at 12:55
  • lol my problem with google is I guess I'm too descriptive when I do my searches -=D Thanx top link had what I needed! (of your edit post that is) – Joey Jan 30 '11 at 04:19