Ich lege eine Anmeldung in getType() -Methode wird nie gedruckt. Ich verwende den Notepad-Beispielcode. Bitte erläutern Sie die erste Zeile des Java-Dokumentationskommentars. Die Rückgabe von null aus getType() funktioniert auch gut. Was ist der Zweck der getType() -Methode?Android ContentProvider getType() aufgerufen, wenn und warum
/**
* This is called when a client calls {@link android.content.ContentResolver#getType(Uri)}.
* Returns the MIME data type of the URI given as a parameter.
*
* @param uri The URI whose MIME type is desired.
* @return The MIME type of the URI.
* @throws IllegalArgumentException if the incoming URI pattern is invalid.
*/
@Override
public String getType(Uri uri)
{
Log.d("Suparna", "******getType()");
/*switch(uriMatcher.match(uri))
{
// ---get all books---
case BOOK_DETAILS:
return Book.Book_Details.CONTENT_TYPE;
// ---get a particular book---
case BOOK_DETAILS_ID:
return Book.Book_Details.CONTENT_ITEM_TYPE;
default:
throw new IllegalArgumentException("Unsupported URI: " + uri);
}*/
return null;
}
Der Grund, warum diese Frage keine Aufmerksamkeit bekam, ist, weil Sie vergessen haben, es mit "android" zu markieren. :) –
http://stackoverflow.com/questions/5351669/why-use-contentprovider-gettype-to-get-mime-type kann Hilfe sein u. – boiledwater