There is a problem today:
Java code Mringtonemanager.settype (ringtonemanager.type_alarm); cursor mcursor = mringtonemanager.getcursor (); if (mcursor != null) { if (Mcursor.movetofirst ()) { do{             LOG.D ("mCursor11111", Mcursor.getstring (0));     LOG.D ("mCursor22222", mcursor.getstring (1));     LOG.D ("mCursor33333", mcursor.getstring (2));                 LOG.D (" mCursor44444 ", mcursor.getstring (3)); } while (Mcursor.movetonext ()); } }
Mringtonemanager.settype (ringtonemanager.type_alarm);
Cursor mcursor = Mringtonemanager.getcursor ();
if (mcursor!= null) {
if (Mcursor.movetofirst ()) {
do{
log.d ("mCursor11111", mcursor.getstring (0));
LOG.D ("mCursor22222", mcursor.getstring (1));
LOG.D ("mCursor33333", mcursor.getstring (2));
LOG.D ("mCursor44444", Mcursor.getstring (3));
} while (Mcursor.movetonext ());
}
}
Because I don't know the field values of the database, I print them all,
The second value was found to be Content://media/internal/audio/media
The third value is Rooster Alarm
So take it for granted that two values are spliced Content://media/internal/audio/media/rooster Alarm
So the following conversion
Java code Uri u = Uri.parse ("Content://media/internal/audio/media/rooster Alarm"); Mmediaplayer.setdatasource (Context,u);
Uri u = uri.parse ("Content://media/internal/audio/media/rooster Alarm");
Mmediaplayer.setdatasource (Context,u);
Finally reported the following error:
Java.lang.NumberFormatException:unable to parse ' Content://media/internal/audio/media/rooster Alarm ' As Integer
Baffled
In addition to the URI this thing is also confused, no good information for the time being found
The most important question is: Can the URI be converted to a specific local file address. For example, Content://media/internal/audio/media/rooster Alarm can be converted into/mnt/sdcard/rooster Alarm.mp3.
This is a lot of questions, mark it first.
----------------------------------------
The above issues have been resolved:
That's my understanding: The URI is an access address,
1. The "content://" is the ContentProvider application, which can represent a table in a database, or a piece of data. When a specific piece of data is represented, it is often terminated by the ID of the data table: CONTENT://COM.TEST.TAB/1.
2. The expression "file://" refers to the path address of a file
3. Of course there are other formats: "http://", "ftp://" and so on.
So my code in the above should read:
Java code//uri u = Uri.parse ("Content://media/internal/audio/media/rooster Alarm"); Uri u = uri.parse ("content://media/internal/audio/media/81");//"81" is the "_id" field in the datasheet mmediaplayer.setdatasource ( CONTEXT,U);