当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getDataString方法代码示例

本文整理汇总了Java中android.content.Intent.getDataString方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getDataString方法的具体用法?Java Intent.getDataString怎么用?Java Intent.getDataString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getDataString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActivityResultAboveL

import android.content.Intent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void onActivityResultAboveL(int requestCode, int resultCode, Intent intent) {
    if (requestCode != FILECHOOSER_RESULTCODE || mUploadCallbackAboveL == null)
        return;
    Uri[] results = null;
    if (resultCode == Activity.RESULT_OK) {
        if (intent != null) {
            String dataString = intent.getDataString();
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                results = new Uri[clipData.getItemCount()];
                for (int i = 0; i < clipData.getItemCount(); i++) {
                    ClipData.Item item = clipData.getItemAt(i);
                    results[i] = item.getUri();
                }
            }
            if (dataString != null)
                results = new Uri[]{Uri.parse(dataString)};
        }
    }
    mUploadCallbackAboveL.onReceiveValue(results);
    mUploadCallbackAboveL = null;
}
 
开发者ID:JunGeges,项目名称:AliZhiBoHao,代码行数:24,代码来源:WebActivity.java

示例2: processData

import android.content.Intent; //导入方法依赖的package包/类
private Uri[] processData(Intent data) {

        Uri[] datas = null;
        if (data == null) {
            return datas;
        }
        String target = data.getDataString();
        if (!TextUtils.isEmpty(target)) {
            return datas = new Uri[]{Uri.parse(target)};
        }
        ClipData mClipData = data.getClipData();
        if (mClipData != null && mClipData.getItemCount() > 0) {
            datas = new Uri[mClipData.getItemCount()];
            for (int i = 0; i < mClipData.getItemCount(); i++) {

                ClipData.Item mItem = mClipData.getItemAt(i);
                datas[i] = mItem.getUri();

            }
        }
        return datas;


    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:25,代码来源:FileUpLoadChooserImpl.java

示例3: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode==REQUEST_CODE){
        if(resultCode==RESULT_OK){
            findViewById(R.id.log_in)
                    .animate()
                    .scaleX(0)
                    .scaleY(0)
                    .setDuration(300)
                    .start();
            String string=data.getDataString();
            String code= Uri.parse(string).getQueryParameter("code");
            SoundCloudAuth.create(Config.CLIENT_ID,Config.CLIENT_SECRET_ID)
                    .addRedirectUri(Config.REDIRECT_URI)
                    .tokenWithAuthCode(code)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(this::saveToken);
        }
    }
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:23,代码来源:AuthActivity.java

示例4: getUrlFromIntent

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Retrieve the URL from the Intent, which may be in multiple locations.
 * @param intent Intent to examine.
 * @return URL from the Intent, or null if a valid URL couldn't be found.
 */
public static String getUrlFromIntent(Intent intent) {
    if (intent == null) return null;

    String url = getUrlFromVoiceSearchResult(intent);
    if (url == null) url = ActivityDelegate.getInitialUrlForDocument(intent);
    if (url == null) url = getUrlForCustomTab(intent);
    if (url == null) url = intent.getDataString();
    if (url == null) return null;

    url = url.trim();
    if (isGoogleChromeScheme(url)) {
        url = getUrlFromGoogleChromeSchemeUrl(url);
    }
    return TextUtils.isEmpty(url) ? null : url;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:IntentHandler.java

示例5: startService

import android.content.Intent; //导入方法依赖的package包/类
private void startService() {
    final Intent intent = super.getIntent();
    if (intent == null || intent.getBooleanExtra(Intent.EXTRA_INTENT, false)) {
        serviceAction(ServiceAction.SHOW);
        return;
    }
    String uri = intent.getDataString();
    if (uri != null && (uri.contains(LinkType.NORMAL) || uri.contains(LinkType.SHORT))) {
        startService(uri);
        return;
    }
    uri = intent.getStringExtra(Intent.EXTRA_TEXT);
    if (!TextUtils.isEmpty(uri)) {
        if (!uri.startsWith("http") && (uri.contains(LinkType.NORMAL) || uri.contains(LinkType.SHORT))) {
            uri = uri.substring(uri.indexOf("http"));
        }
        startService(uri);
        return;
    }
    super.finish();
}
 
开发者ID:RollnCode,项目名称:BackTube,代码行数:22,代码来源:PlayerActivity.java

示例6: onActivityResultAboveL

import android.content.Intent; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
   private void onActivityResultAboveL(int requestCode, int resultCode, Intent intent)
{
       if (requestCode != FILE_CHOOSER_RESULT_CODE || uploadMessageAboveL == null)
           return;
       Uri[] results = null;
       if (resultCode == Activity.RESULT_OK)
	{
           if (intent != null)
		{
               String dataString = intent.getDataString();
               ClipData clipData = intent.getClipData();
               if (clipData != null)
			{
                   results = new Uri[clipData.getItemCount()];
                   for (int i = 0; i < clipData.getItemCount(); i++)
				{
                       ClipData.Item item = clipData.getItemAt(i);
                       results[i] = item.getUri();
                   }
               }
               if (dataString != null)
                   results = new Uri[]{Uri.parse(dataString)};
           }
       }
       uploadMessageAboveL.onReceiveValue(results);
       uploadMessageAboveL = null;
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:29,代码来源:x5_MainActivity.java

示例7: onReceive

import android.content.Intent; //导入方法依赖的package包/类
public static void onReceive(Context context, Intent intent) {
    if (intent != null) {
        String intentAction = intent.getAction();
        final String sPackageName = intent.getDataString();
        if (TextUtils.isEmpty(sPackageName)) {
            return;
        }
        final String pkgName = sPackageName.substring(sPackageName.indexOf(':') + 1);
        if (TextUtils.isEmpty(pkgName)) {
            return;
        }
        if (Intent.ACTION_PACKAGE_ADDED.equals(intentAction) || Intent.ACTION_PACKAGE_REPLACED.equals(intentAction) || Intent.ACTION_PACKAGE_REMOVED.equals(intentAction)) {
            boolean contains = isContainsKey(pkgName);
            logPrint("onReceive  pkgName=" + pkgName + "  isContainsKey=" + contains);
            if (contains) {
                updateInstallState(pkgName, SmartInstallItem.installComplete);
            }
        }
    }
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:21,代码来源:SmartInstaller.java

示例8: handleNewIntent

import android.content.Intent; //导入方法依赖的package包/类
public void handleNewIntent(Intent intent) {

		String url = null;
		if (intent != null) {
			url = intent.getDataString();
		}
		int num = 0;

		int type=0;
		if (intent != null && intent.getExtras() != null) {
			num = intent.getExtras().getInt(getPackageName() + ".Origin");
			//type=intent.getExtras().getInt("type");
			//ToastUtil.showMessage("this type "+type);
		}
		if (num == 1) {
			LightningView lv=getCurrentWebView();
			lv.loadUrl(url);
		} else if (url != null) {
			if (url.startsWith(Constants.FILE)) {
				Utils.showToast(this, getResources().getString(R.string.message_blocked_local));
				url = null;
			}
			newTab(url, true);
			mIsNewIntent = true;
		}
	}
 
开发者ID:Louis19910615,项目名称:youkes_browser,代码行数:27,代码来源:BrowserActivity.java

示例9: onPostCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    Intent intent = getIntent();

    if(intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
        String data = intent.getDataString();
        switch (data) {
            case "anime":
                shortcut = R.id.nav_anime;
                break;
            case "manga":
                shortcut = R.id.nav_manga;
                break;
            case "trending":
                shortcut = R.id.nav_trending;
                break;
            case "reviews":
                shortcut = R.id.nav_reviews;
                break;
        }
    }
    if(status != 0)
        try {
            if(requesting)
                requesting = false;
            app_status.setText(getString(status));
        } catch(Exception e){
            e.printStackTrace();
        }
    intiApplication();
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:33,代码来源:SplashActivity.java

示例10: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    if (Build.VERSION.SDK_INT >= 21) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
        Uri[] results = null;
        if (resultCode == Activity.RESULT_OK) {
            if (requestCode == asw_file_req) {
                if (null == asw_file_path) {
                    return;
                }
                if (intent == null) {
                    if (asw_cam_message != null) {
                        results = new Uri[]{Uri.parse(asw_cam_message)};
                    }
                } else {
                    String dataString = intent.getDataString();
                    if (dataString != null) {
                        results = new Uri[]{ Uri.parse(dataString) };
                    }
                }
            }
        }
        asw_file_path.onReceiveValue(results);
        asw_file_path = null;
    } else {
        if (requestCode == asw_file_req) {
            if (null == asw_file_message) return;
            Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
            asw_file_message.onReceiveValue(result);
            asw_file_message = null;
        }
    }
}
 
开发者ID:mgks,项目名称:Android-SmartWebView,代码行数:36,代码来源:MainActivity.java

示例11: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
	String action = intent.getAction();
       String dataString = intent.getDataString();
	if (PACKAGE_REPLACED.equals(action)) {
           Log.d("PackageReplaceReceiver", "Received " + dataString);
           if ("package:ru.orangesoftware.financisto".equals(dataString)) {
               Log.d("PackageReplaceReceiver", "Re-scheduling all transactions");
               requestScheduleAll(context);
               requestScheduleAutoBackup(context);
               requestScheduleAutoSync(context);                
           }
	}
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:15,代码来源:PackageReplaceReceiver.java

示例12: onNewIntent

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(final Intent intent) {
    super.onNewIntent(intent);

    setIntent(intent);

    final String feedUrl = intent.getDataString();

    if (!TextUtils.isEmpty(feedUrl)) {
        newFeedSubscriptionIntentReceived(feedUrl, false);
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:13,代码来源:MainActivity.java

示例13: onHandleIntent

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent, @Nullable MasterSecret masterSecret) {
  if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(intent.getAction())) {
    Log.w(TAG, "Received unknown intent: " + intent.getAction());
    return;
  }

  if (masterSecret == null) {
    Log.w(TAG, "Got quick response request when locked...");
    Toast.makeText(this, R.string.QuickResponseService_quick_response_unavailable_when_Signal_is_locked, Toast.LENGTH_LONG).show();
    return;
  }

  try {
    Rfc5724Uri uri        = new Rfc5724Uri(intent.getDataString());
    String     content    = intent.getStringExtra(Intent.EXTRA_TEXT);
    String     numbers    = uri.getPath();
    if(numbers.contains("%")){
      numbers = URLDecoder.decode(numbers);
    }

    Recipients                      recipients     = RecipientFactory.getRecipientsFromString(this, numbers, false);
    Optional<RecipientsPreferences> preferences    = DatabaseFactory.getRecipientPreferenceDatabase(this).getRecipientsPreferences(recipients.getIds());
    int                             subscriptionId = preferences.isPresent() ? preferences.get().getDefaultSubscriptionId().or(-1) : -1;
    long                            expiresIn      = preferences.isPresent() ? preferences.get().getExpireMessages() * 1000 : 0;

    if (!TextUtils.isEmpty(content)) {
      if (recipients.isSingleRecipient()) {
        MessageSender.send(this, masterSecret, new OutgoingTextMessage(recipients, content, expiresIn, subscriptionId), -1, false, null);
      } else {
        MessageSender.send(this, masterSecret, new OutgoingMediaMessage(recipients, new SlideDeck(), content, System.currentTimeMillis(),
                                                                        subscriptionId, expiresIn, ThreadDatabase.DistributionTypes.DEFAULT), -1, false, null);
      }
    }
  } catch (URISyntaxException e) {
    Toast.makeText(this, R.string.QuickResponseService_problem_sending_message, Toast.LENGTH_LONG).show();
    Log.w(TAG, e);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:40,代码来源:QuickResponseService.java

示例14: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {


    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {

        if (requestCode == FILECHOOSER_RESULTCODE) {
            if (null == this.mUploadMessage) {
                return;
            }

            Uri result = null;

            try {
                if (resultCode != RESULT_OK) {
                    result = null;
                } else {
                    // retrieve from the private variable if the intent is null
                    result = data == null ? mCapturedImageURI : data.getData();
                }
            } catch (Exception e) {

            }

            mUploadMessage.onReceiveValue(result);
            mUploadMessage = null;
        }

    }


    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        if (requestCode != FILECHOOSER_RESULTCODE || mFilePathCallback == null) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }

        Uri[] results = null;

        if (resultCode == Activity.RESULT_OK) {
            if (data == null) {

                if (mCameraPhotoPath != null) {
                    results = new Uri[]{Uri.parse(mCameraPhotoPath)};
                }
            } else {
                String dataString = data.getDataString();
                if (dataString != null) {
                    results = new Uri[]{Uri.parse(dataString)};
                }
            }
        }

        mFilePathCallback.onReceiveValue(results);
        mFilePathCallback = null;

    }
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:60,代码来源:QuickInstagram.java

示例15: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {


	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {

		if (requestCode == FILECHOOSER_RESULTCODE) {
			if (null == this.mUploadMessage) {
				return;
			}

			Uri result = null;

			try {
				if (resultCode != RESULT_OK) {
					result = null;
				} else {
					// retrieve from the private variable if the intent is null
					result = data == null ? mCapturedImageURI : data.getData();
				}
			} catch (Exception e) {

			}

			mUploadMessage.onReceiveValue(result);
			mUploadMessage = null;
		}

	}


	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

		if (requestCode != FILECHOOSER_RESULTCODE || mFilePathCallback == null) {
			super.onActivityResult(requestCode, resultCode, data);
			return;
		}

		Uri[] results = null;

		if (resultCode == Activity.RESULT_OK) {
			if (data == null) {

				if (mCameraPhotoPath != null) {
					results = new Uri[]{Uri.parse(mCameraPhotoPath)};
				}
			} else {
				String dataString = data.getDataString();
				if (dataString != null) {
					results = new Uri[]{Uri.parse(dataString)};
				}
			}
		}

		mFilePathCallback.onReceiveValue(results);
		mFilePathCallback = null;

	}
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:60,代码来源:StandartMessages.java


注:本文中的android.content.Intent.getDataString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。