src/android/Serializer.java
/** Extract the list of items from clip data (if available).
     *
     * Defaults to null. */
Extract the list of items from clip data (if available).
Defaults to null.
Extract the list of items from clip data ( if available ) . Defaults to null .
public static JSONArray itemsFromClipData(
            final ContentResolver contentResolver,
            final ClipData clipData)
            throws JSONException {
        if (clipData != null) {
            final int clipItemCount = clipData.getItemCount();
            JSONObject[] items = new JSONObject[clipItemCount];
            for (int i = 0; i < clipItemCount; i++) {
                if(clipData.getItemAt(i).getText() != null) {
                    final JSONObject json = new JSONObject();
                    json.put("type","text/plain");
                    json.put("text", clipData.getItemAt(i).getText());
                    items[i] = json;
                } else
                    items[i] = toJSONObject(contentResolver, clipData.getItemAt(i).getUri());
            }
            return new JSONArray(items);
        }
        return null;
    }
public static JSONArray itemsFromClipData ( final ContentResolver contentResolver , final ClipData clipData ) throws JSONException { if ( clipData != null ) { final int clipItemCount = clipData . getItemCount ( ) ; JSONObject [ ] items = new JSONObject [ clipItemCount ] ; for ( int i = 0 ; i < clipItemCount ; i ++ ) { if ( clipData . getItemAt ( i ) . getText ( ) != null ) { final JSONObject json = new JSONObject ( ) ; json . put ( "type" , "text/plain" ) ; json . put ( "text" , clipData . getItemAt ( i ) . getText ( ) ) ; items [ i ] = json ; } else items [ i ] = toJSONObject ( contentResolver , clipData . getItemAt ( i ) . getUri ( ) ) ; } return new JSONArray ( items ) ; } return null ; }
Extract the list of items from clip data (if available).
Extract the list of items from clip data ( if available ) .