= = Telephonymanager.call_state_idle) {
Start playing again
if (Mresumeaftercall) {
Resume playback only if music is playing
When the call was answered
try {
Stub.resume ();
catch (RemoteException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
Mresumeaftercall = false;
}
}
}
};
When it is used, it is added in the oncreate of the service, as follows:
Copy Code code as follows:
public void OnCreate () {
Player
Use the interfaces provided by the android SDK to develop the simplest video playback demo.Next, paste the source code of main. xml:[Html]Xmlns: tools = "http://schemas.android.com/tools"Android: layout_width = "match_parent"Android: layout_height = "match_parent">Android: id = "@ + id/surfaceView1"
In a music player, the playback mode is generally automatically recognized after the music is played. The following logic code is provided. You can add the appropriate code as needed.
Public static final int ALL = 0; // ALL Loops
Public static final int SINGLE = 1; // SINGLE Loop
Public static final int RANDOM = 2; // RANDOM
// After playing a song (set the playing mode here)
Public class Completed implements OnCompletionListener
{
@ Override
Public v
. setOnSeekBarChangeListener (new OnSeekBarChangeListener () {@ Overridepublic void onStopTrackingTouch (SeekBar seekBar) {mp. start (); // when you stop dragging the progress bar, the music starts to play.} @ Overridepublic void onStartTrackingTouch (SeekBar seekBar) {mp. pause (); // when you start dragging the progress bar, the music is paused.} @ Overridepublic void onProgressChanged (SeekBar seekBar, int progress, boolean fromUser) {if (fromUser) {mp. seekTo (progress); // when the progress
In the music player, the playback mode is usually placed in the music after the automatic recognition, the following gives the logical code, you can add appropriate code as needed
public static final int all = 0;//full loop
public static final int singles = 1;//single loop
public static final int RANDOM = 2;//random
After a song is finished (set playback mode here)
public class Completed implements Oncompletionlistener
{
@Override
public void
In the music player, the playback mode is usually placed in the music after the automatic recognition, the following gives the logical code, you can add appropriate code as needed
public static final int all = 0;//full loop public
static final int single = 1;//singles loop public
static final int RANDOM = 2;//random
//A song after playback is complete (set playback mode here) public
class Completed implements Oncompletionlistener
Weekend play a little Hi, did not update the blog, today to make up, this oscilloscope is in the university when the teacher taught, but out of work has not been used, and gradually forget, and now learn again. Look at the effect chart:
Here is a custom histogram, and then there is a button, click the button, where the pillars will keep moving, similar to the music player in the oscilloscope beat.
Similar to the previous custom view, rewrite the O
[Four features of sound: pitch, sound length, volume, and tone] --- basic five-line spectrum tutorial
Android project analysis generally starts from androidmanifest. starting from the XML file, we can see the configuration of the activity, service, and other four components defined by this app, as well as the SDK version and declared permissions.
1. Order of tags
First, use the android lint tool to check
In Android, you cannot directly use Gif images to play frame animations. The following animations cannot be played in Android:
Android provides another solution, which is to use the AnimationDrawable function to enable frame-by-frame playback. But how can we split gif images into images of each frame? The following describes two types of good software that can h
MediaPlayer In addition to audio playback, but also can play the video, but if you want to play video only rely on MediaPlayer is not enough, you also need to write a video display space, and this display space requirements can be quickly updated GUI The GUI can be rendered without blocking while rendering the code, and if you want to do this, You must rely on the Android.view.SurfaceView component to complete, and the Surfaceview component encapsulates a surface object instead of a canvas objec
When the Android system is started, it will automatically detect the SD card files and collect music files to generate a database file. We only need to access the information in the database table to obtain the required File Code as follows:
Obtain the cursor object to access the media resources in the cursor.
If (cursor. moveToFirst () {do {String title = cursor. getString (cursor. getColumnIndex (MediaStore. audio. media. TITLE); String singer = cu
Playing MP3 in Android is very simple and often used in projects, such as background music for projects and prompts for certain functions in applications. It is widely used. Here is a simple example:
Layout file Configuration:
Java implementation file:
/*****/Package COM. demo. media; import android. app. activity; import android. media. mediaplayer; import
I believe everyone has seen the cool dog music player, especially the cool dog rolling lyrics to achieve, the effect is particularly good. I also try to look at the cool dog lyrics file, found to be encrypted, can not see at all, so only from the current open source lyrics files. I chose the KSC lyrics file myself.To achieve the function of the lyrics, it is first to understand the KSC lyrics of the document and the common LRC lyrics have that aspect
This paper develops a service based music player, the music is run by the background of the service is responsible for playback, when the background of the playback status changes, the program will be sent to notify the front desk Activity update interface; When you click the activity's Interface button, The system will change the playback status by sending a broadcast notification to the background service.
The foreground activity interface has two
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.