本文整理匯總了Java中android.net.Uri.isHierarchical方法的典型用法代碼示例。如果您正苦於以下問題:Java Uri.isHierarchical方法的具體用法?Java Uri.isHierarchical怎麽用?Java Uri.isHierarchical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.net.Uri
的用法示例。
在下文中一共展示了Uri.isHierarchical方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: matchesSafely
import android.net.Uri; //導入方法依賴的package包/類
@Override
protected boolean matchesSafely(Uri item) {
if (!item.isAbsolute()
|| !item.isHierarchical()
|| TextUtils.isEmpty(item.getScheme())
|| TextUtils.isEmpty(item.getAuthority())) {
return false;
}
if (!mPermittedSchemes.isEmpty() && !mPermittedSchemes.contains(item.getScheme())) {
return false;
}
if (mAllowPathQueryOrFragment) {
return true;
}
return TextUtils.isEmpty(item.getPath())
&& item.getQuery() == null
&& item.getFragment() == null;
}
示例2: getUrl
import android.net.Uri; //導入方法依賴的package包/類
private String getUrl(Uri uri) {
String url = uri.toString();
String scheme = uri.getScheme();
if (uri.isHierarchical()) {
if (TextUtils.equals(scheme, "http") || TextUtils.equals(scheme, "https")) {
String weexTpl = uri.getQueryParameter(Constants.WEEX_TPL_KEY);
if (!TextUtils.isEmpty(weexTpl)) {
url = weexTpl;
}
}
}
return url;
}
示例3: onCreate
import android.net.Uri; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedState) {
super.onCreate(savedState);
application = (VoicemeApplication) getApplication();
bus = application.getBus();
scheduler = new ActionScheduler(application);
preferences = getSharedPreferences(CONSTANT_PREF_FILE, Context.MODE_PRIVATE);
// ActivityUtils.deleteAudioFile(this.getBaseContext())
/* File direct = new File(Environment.getExternalStorageDirectory() + "/DirName");
if (!direct.exists()) {
direct.mkdirs();
}
*/
Uri data = this.getIntent().getData();
if (data != null && data.isHierarchical()) {
String uri = this.getIntent().getDataString();
String idStr = uri.substring(uri.lastIndexOf('=') + 1);
id = (idStr);
Log.e("int value", ":======" + id);
if (!id.equals("0")) {
Intent intent = new Intent(BaseActivity.this, PostsDetailsActivity.class);
intent.putExtra(Constants.POST_BACKGROUND, id);
startActivity(intent);
}
}
mTracker = application.getDefaultTracker();
bus.register(this);
isRegisterdWithBus = true;
givenContact = preferences.getString(Constants.GET_CONTACT_NUMBER, null);
givenFacebook = preferences.getString(Constants.FACEBOOK_ID, null);
/**
* Initialize Facebook SDK
FacebookSdk.sdkInitialize(getApplicationContext()); */
/**
* Initializes the sync client. This must be call before you can use it. */
}