Wednesday, June 9, 2010

Re: [android-developers] Problem in Controlling Audio

Just check for user permission for changing audio manager and add in the AndroidManifest file.

On Tue, Jun 8, 2010 at 11:15 AM, Alok <alokmishra.besu@gmail.com> wrote:
Hello,

I have some years of experience in C/C++ and bit of Java programming
in Linux, but I'm new to Android.

For start I'm trying to develop a video player on android. I'm able to
play the video using the VideoView widget. But when I'm trying to
control the volume using AudioManager, the application crashes saying:
"The application Video (process com.android.video) has stopped
unexpectedly. Please try again."

If it helps : I've downloaded the Android source (ECLAIR) and using
the sdk directly from the source and I'm using Eclipse 3.1.1. I've
successfully run the sample apps from the source code.

The following is a snapshot of what I'm trying to do in my code:

[code]
package com.android.video;
....
import android.media.AudioManager;
....
public class Video extends Activity {
  .
  .
  private AudioManager MyAudio;
  .
  .
  .
  MyVolUp.setOnClickListener(new OnClickListener(){
     public void onClick(View view) {
           MyAudio.adjustStreamVolume(MyAudio.STREAM_MUSIC,
MyAudio.ADJUST_RAISE, MyAudio.FLAG_PLAY_SOUND);
           }
     });
  .
  .

[/code]

1. What am I doing wrong here?
2. I was going through the Android source and saw that AudioManager
(even MediaPlayer) are using the native functions for handling audio.
How can I use those native function (just for experimenting, not
related to my project) in my application? We can do it using JNI but
I'm not sure how to use the native functions already there in android.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment