Example usage for android.net Uri buildUpon

List of usage examples for android.net Uri buildUpon

Introduction

In this page you can find the example usage for android.net Uri buildUpon.

Prototype

public abstract Builder buildUpon();

Source Link

Document

Constructs a new builder, copying the attributes from this Uri.

Usage

From source file:Main.java

public static Uri setUriAsCalledFromSyncAdapter(Uri uri) {
    return uri.buildUpon().appendQueryParameter(QUERY_PARAMETER_CALLER_IS_SYNC_ADAPTER, "true").build();
}

From source file:Main.java

/**
 * Take an environment URI (one that identifies an environment) and produce an
 * event URI./*from  w w  w  .  jav a  2s . co m*/
 *
 * That this is needed is tragic.
 *
 * @param environmentURI
 *          the {@link Uri} returned by an environment operation.
 * @return a {@link Uri} to which insertions can be dispatched.
 */
public static Uri getEventURI(Uri environmentURI) {
    return environmentURI.buildUpon().path("/events/" + ContentUris.parseId(environmentURI) + "/").build();
}

From source file:Main.java

/**
 * Adds an account override parameter to the {@code uri}. This is used by the
 * {@link ScheduleProvider} when fetching account-specific data.
 *//*w  w  w . j av a  2 s  . co  m*/
public static Uri addOverrideAccountName(Uri uri, String accountName) {
    return uri.buildUpon().appendQueryParameter(QUERY_PARAMETER_OVERRIDE_ACCOUNT_NAME, accountName).build();
}

From source file:Main.java

public static String jointUrl(String url, Map<String, String> params) {
    if (params != null && params.size() > 0) {
        Uri uri = Uri.parse(url);
        Uri.Builder b = uri.buildUpon();
        for (Map.Entry<String, String> entry : params.entrySet()) {
            b.appendQueryParameter(entry.getKey(), entry.getValue());
        }//from  w  w  w .  ja v a2  s.c  o  m
        return b.build().toString();
    }
    return url;
}

From source file:edu.mit.mobile.android.locast.data.tags.TaggableUtils.java

public static Uri getTagPath(Uri item) {
    return item.buildUpon().appendPath(PATH).build();
}

From source file:com.stockbrowser.BookmarksLoader.java

static Uri addAccount(Uri uri, String accountType, String accountName) {
    return uri.buildUpon().appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_TYPE, accountType)
            .appendQueryParameter(BrowserContract.Bookmarks.PARAM_ACCOUNT_NAME, accountName).build();
}

From source file:edu.mit.mobile.android.locast.data.tags.TaggableUtils.java

public static Uri getItemMatchingTags(Uri contentDir, String... tag) {

    return contentDir.buildUpon().appendQueryParameter(QUERY_PARAMETER_TAGS, TextUtils.join(",", tag)).build();
}

From source file:Main.java

public static Long getOrCreateThreadId(Context context, String phone) {
    try {/*from  w w w. j a  va2  s.  co  m*/
        Uri threadIdUri = Uri.parse("content://mms-sms/threadID");
        Uri.Builder builder = threadIdUri.buildUpon();
        String[] recipients = { phone };
        for (String recipient : recipients) {
            builder.appendQueryParameter("recipient", recipient);
        }
        Uri uri = builder.build();
        Long threadId = 0L;
        Cursor cursor = context.getContentResolver().query(uri, new String[] { "_id" }, null, null, null);
        if (cursor != null) {
            try {
                if (cursor.moveToFirst()) {
                    threadId = cursor.getLong(0);
                }
            } finally {
                cursor.close();
            }
            return threadId;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return -1L;
}

From source file:com.mobilesolutionworks.android.util.TypeUtils.java

/**
 * Build uri with path specified in args
 *
 * @param base base Uri//from w  w  w  .  ja  va  2 s . co m
 * @param args appended paths
 * @return Uri containing base Uri with appended paths
 */
public static Uri buildUri(Uri base, String... args) {
    Uri.Builder builder = base.buildUpon();
    for (String arg : args) {
        builder.appendPath(arg);
    }
    return builder.build();
}

From source file:edu.stanford.mobisocial.dungbeetle.social.FriendRequest.java

/**
 * Returns a friending uri under the 'musubi' scheme.
 *///from ww w  .j  a va 2 s  .co  m
public static Uri getMusubiUri(Context c) {
    Uri uri = getInvitationUri(c, true);
    return uri.buildUpon().scheme("musubi").build();
}