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


Java Intent.getStringExtra方法代码示例

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


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

示例1: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	if (requestCode == 1) {
		if (resultCode == RESULT_FIRST_USER) {
			filter.clearDateTime();
		} else if (resultCode == RESULT_OK) {
			String periodType = data.getStringExtra(DateFilterActivity.EXTRA_FILTER_PERIOD_TYPE);
			PeriodType p = PeriodType.valueOf(periodType);
			if (PeriodType.CUSTOM == p) {
				long periodFrom = data.getLongExtra(DateFilterActivity.EXTRA_FILTER_PERIOD_FROM, 0);
				long periodTo = data.getLongExtra(DateFilterActivity.EXTRA_FILTER_PERIOD_TO, 0);
				filter.put(new DateTimeCriteria(periodFrom, periodTo));
			} else {
				filter.put(new DateTimeCriteria(p));
			}			
		}
		updatePeriod();
	}
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:20,代码来源:AbstractExportActivity.java

示例2: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data )
{
	switch ( requestCode )
	{
		case REQUEST_CONNECT_DEVICE_SECURE:
			// When DeviceListActivity returns with a device to connect
			if ( resultCode == Activity.RESULT_OK )
			{
				String address = null;

				if ( (address = data.getStringExtra( DeviceListActivity.EXTRA_DEVICE_ADDRESS )) != null )
				{
					boolean isLe = data.getBooleanExtra( DeviceListActivity.EXTRA_IS_BLUETOOTH_LE, false);
					penClientCtrl.setLeMode(isLe);
					penClientCtrl.connect( address );
				}
			}
			break;
	}
}
 
开发者ID:NeoSmartpen,项目名称:AndroidSDK2.0,代码行数:22,代码来源:MainActivity.java

示例3: initData

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void initData(Intent intent, Handler handler) {
    this.intent = intent;
    mSetLineView.initView();

    calculatePreference = AppConfig.dPreferences.getInt(NaviSetLineActivity.CALCULATE_MODE, BaiduNaviManager.RoutePlanPreference.ROUTE_PLAN_MOD_RECOMMEND);
    preStartTips = mContext.getResources().getStringArray(R.array.navi_pre_start_tips);
    address = ((AppConfig) mContext.getApplication()).address;

    /* 初始化地图、导航引擎 */
    naviManager = new BaiduNaviSuperManager(mContext, naviInitListener, handler);
    this.mHandler = handler;
    if (this.intent != null) {
        int calculateMode = intent.getIntExtra("calculateMode", 0);
        if (calculateMode != 0)
            calculatePreference = calculateMode;
        passPoint = intent.getStringExtra("passPoint");
        mixCalculateType = (calculateType = intent.getIntExtra("type", 0));
        calculateRoad = intent.getIntExtra(NaviSetLineActivity.CALCULATE_ROAD, NaviSetLineActivity.UN_CALCULATE);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:22,代码来源:NaviSetLinePresenter.java

示例4: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == Activity.RESULT_OK) {
                switch (requestCode) {
                        case Constant.REQUEST_CODE_REGISTER:
                                String name = data.getStringExtra("username");
                                String password = data.getStringExtra("password");
                                if (name != null && password != null) {
                                        passWord.setText(password);
                                        userName.setText(name);
                                }
                                isFirstLogin = true;
                                break;
                }
        }
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:18,代码来源:LoginActivity.java

示例5: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_history_details);
    tvCode = (TextView) findViewById(R.id.tvCodeHD);
    action_navigation = (BottomNavigationView) findViewById(R.id.history_action_navigation);
    BottomNavigationViewHelper.disableShiftMode(action_navigation);
    action_navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
    historyDatabaseHelper = new DatabaseHelper(this);

    //Get the extra information from the history listview. and set the text in the textview eqaul to code
    Intent receivedIntent = getIntent();
    selectedID = receivedIntent.getIntExtra("id", -1); //-1 is the default value
    selectedCode = receivedIntent.getStringExtra("code");
    tvCode.setText(selectedCode);

}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:18,代码来源:HistoryDetailsActivity.java

示例6: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == PCLOUD_AUTHORIZATION_REQUEST_CODE) {
        AuthorizationResult result = (AuthorizationResult) data.getSerializableExtra(AuthorizationActivity.KEY_AUTHORIZATION_RESULT);
        authorizationResultView.setText(result.name());

        if (result == AuthorizationResult.ACCESS_GRANTED) {
            String accessToken = data.getStringExtra(AuthorizationActivity.KEY_ACCESS_TOKEN);
            long userId = data.getLongExtra(AuthorizationActivity.KEY_USER_ID, 0);
            apiKeyView.setText(accessToken);
            //TODO: Do what's needed :)
        } else {
            //TODO: Add proper handling for denied grants or errors.
        }
    }
}
 
开发者ID:pCloud,项目名称:pcloud-sdk-java,代码行数:18,代码来源:MainActivity.java

示例7: onHandleIntent

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    if (intent != null) {
        final String action = intent.getAction();
        if (IPP_PRINT.equals(action)) {
            final String param1 = intent.getStringExtra(FILE_PATH);
            final String param2 = intent.getStringExtra(JOB_NAME);
            final String param3 = intent.getStringExtra(CONNECTION_TYPE);
            final String param4 = intent.getStringExtra(PRINTER_ADDRES);
            final int param5 = intent.getIntExtra(PRINTER_PORT,-1);
            final String param6 = intent.getStringExtra(PRINTER_URI);

            handleActionIppPrint(param1, param2, param3, param4, param5, param6);
        }
    }
}
 
开发者ID:bencikpeter,项目名称:3DPrintingProtocols,代码行数:17,代码来源:PrintingService.java

示例8: parseIdFromIntent

import android.content.Intent; //导入方法依赖的package包/类
private long parseIdFromIntent(@NonNull Intent intent, String longKey,
                               String stringKey) {
    long id = intent.getLongExtra(longKey, -1);
    if (id < 0) {
        String idString = intent.getStringExtra(stringKey);
        if (idString != null) {
            try {
                id = Long.parseLong(idString);
            } catch (NumberFormatException e) {
                Log.e(TAG, e.getMessage());
            }
        }
    }
    return id;
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:16,代码来源:MainActivity.java

示例9: handleIntent

import android.content.Intent; //导入方法依赖的package包/类
private void handleIntent(){
    Intent intent = getIntent();
    if(intent != null){
        mUrl = intent.getStringExtra(HomeConstants.KEY_INTENT_ACTIVITY_WEB_URL);
        mHeaderTitle = intent.getStringExtra(HomeConstants.KEY_INTENT_ACTIVITY_HEADER_TITLE);
    }
}
 
开发者ID:Sugarya,项目名称:Closet,代码行数:8,代码来源:WebContainerActivity.java

示例10: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wrapper_news_main);

	Intent intent = getIntent();
	if (intent != null)
	{
		mTitle = intent.getStringExtra("title");
		mKeyword = intent.getStringExtra("keyword");
	}

	if (!TextUtils.isEmpty(mTitle))
	{
		setActionBarTitle(mTitle);
	}
	
	mImageLoader = ImageLoader.getInstance();
	mOptions = DisplayImageBuilder.getDefault()
				.cacheOnDisc(true)
				.considerExifParams(true)
				.bitmapConfig(Bitmap.Config.RGB_565)
				.displayer(new RoundedBitmapDisplayer(6))
				.build();

	doSearch(mKeyword, mPage);
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:29,代码来源:BaiduNewsListActivity.java

示例11: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    /* sanitize the Intent before forwarding it to TorService */
    String action = intent.getAction();
    if (TextUtils.equals(action, ACTION_START)) {
        String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME);

            Intent startTorIntent = new Intent(context, DispatchService.class);
            startTorIntent.setAction(action);
            if (packageName != null)
                startTorIntent.putExtra(EXTRA_PACKAGE_NAME, packageName);
            context.startService(startTorIntent);

    }
}
 
开发者ID:guardianproject,项目名称:AndroidPluggableTransportsDispatchService,代码行数:16,代码来源:DispatchReceiver.java

示例12: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Uri[] results = null;
        // Check that the response is a good one
        if (requestCode == 1) {
            if(resultCode == RESULT_OK) {
                String strEditText = data.getStringExtra("editTextValue");

                if(strEditText.contains("true")){
                    showReports();
                }else{
                  // does nothing...
                }
            }
        }
        if (resultCode == RESULT_OK) {
            if (data == null) {
                // If there is not data, then we may have taken a photo
                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:JaeNuguid,项目名称:Kids-Portal-Android,代码行数:35,代码来源:Fragment_Browser.java

示例13: initIntent

import android.content.Intent; //导入方法依赖的package包/类
private void initIntent() {
    try {
        Intent intent = getIntent();
        if (intent != null) {
            groupId = intent.getStringExtra(UdeskConst.UDESKGROUPID);
            agentId = intent.getStringExtra(UdeskConst.UDESKAGENTID);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:12,代码来源:UdeskChatActivity.java

示例14: encodeFromTextExtras

import android.content.Intent; //导入方法依赖的package包/类
private void encodeFromTextExtras(Intent intent) throws WriterException {
  // Notice: Google Maps shares both URL and details in one text, bummer!
  String theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_TEXT));
  if (theContents == null) {
    theContents = ContactEncoder.trim(intent.getStringExtra("android.intent.extra.HTML_TEXT"));
    // Intent.EXTRA_HTML_TEXT
    if (theContents == null) {
      theContents = ContactEncoder.trim(intent.getStringExtra(Intent.EXTRA_SUBJECT));
      if (theContents == null) {
        String[] emails = intent.getStringArrayExtra(Intent.EXTRA_EMAIL);
        if (emails != null) {
          theContents = ContactEncoder.trim(emails[0]);
        } else {
          theContents = "?";
        }
      }
    }
  }

  // Trim text to avoid URL breaking.
  if (theContents == null || theContents.isEmpty()) {
    throw new WriterException("Empty EXTRA_TEXT");
  }
  contents = theContents;
  // We only do QR code.
  format = BarcodeFormat.QR_CODE;
  if (intent.hasExtra(Intent.EXTRA_SUBJECT)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_SUBJECT);
  } else if (intent.hasExtra(Intent.EXTRA_TITLE)) {
    displayContents = intent.getStringExtra(Intent.EXTRA_TITLE);
  } else {
    displayContents = contents;
  }
  title = activity.getString(R.string.contents_text);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:36,代码来源:QRCodeEncoder.java

示例15: handleSendText

import android.content.Intent; //导入方法依赖的package包/类
/**
 * This method handles Text that was shared by an other app to SecScanQR and generates a qr code
 * @param intent from Share to from other Apps
 */
private void handleSendText(Intent intent){
    String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
    if(sharedText != null){
        text.setText(sharedText);
        text2Qr = sharedText;
    }
}
 
开发者ID:Fr4gorSoftware,项目名称:SecScanQR,代码行数:12,代码来源:GenerateActivity.java


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