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


Java Bundle.getString方法代码示例

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


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

示例1: getApiKeyFromManifest

import android.os.Bundle; //导入方法依赖的package包/类
protected String getApiKeyFromManifest(Context context) {
    String apiKey = null;
    try {
        Bundle bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData;
        if (bundle != null) {
            apiKey = bundle.getString(FABRIC_API_KEY);
            if (apiKey == null) {
                Fabric.getLogger().d(Fabric.TAG, "Falling back to Crashlytics key lookup from Manifest");
                apiKey = bundle.getString(CRASHLYTICS_API_KEY);
            }
        }
    } catch (Exception e) {
        Fabric.getLogger().d(Fabric.TAG, "Caught non-fatal exception while retrieving apiKey: " + e);
    }
    return apiKey;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:17,代码来源:ApiKey.java

示例2: onFragmentResult

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
    super.onFragmentResult(requestCode, resultCode, data);
    switch (requestCode) {
        case HomeFragment.REQUEST_CODE_NEW_CAR:
            if (resultCode == RESULT_OK) {
                UpdateCustomerModel model = (UpdateCustomerModel) data.getSerializable("UpdateCustomerModel");
                requestModel = QueryCustAndOrderInfoModel.buildSingle(model.plates, model.custId, model.custVelId, model.cxId, null, model.mobile, model.custName);
                loadData();
            } else if (resultCode == UseMsgFragment.RESULT_CODE_CHANGE_MOBILE) {
                requestModel.mobile = data.getString("mobile");
                loadData();
            }
            break;
        default:
            loadData();
            break;
    }
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:20,代码来源:ScanResultOrderFragment.java

示例3: onStartCommand

import android.os.Bundle; //导入方法依赖的package包/类
@Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Bundle extras = intent.getExtras();
        if (extras != null) {
            apkName = extras.getString("name");
            downloadUrl = extras.getString("downloadurl");
            Logger.i("DownLoadService: %s", apkName + "\r\n" + downloadUrl);
//            downloadUrl = "http://pro-app-qn.fir.im/f63088ce552e398521ce5840de798c803b29dd2c.apk?attname=appcloud-v1.0.0-huawei-release.apk_V1.0.0.apk&e=1513073607&token=LOvmia8oXF4xnLh0IdH05XMYpH6ENHNpARlmPc-T:zlbPNpvxSrX779NlvRQW0kTjPr0=";
            apkName = apkName + "_" + Long.toString(System.currentTimeMillis() / 1000) + ".apk";
            Log.i(TAG, "apkName: " + apkName);
        }

        //如果路径下apk文件存在,就删除
        File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), apkName);
        if (file.exists()) {
            file.delete();
        }

        //创建广播对象并注册广播,用于监听下载完成后自动安装APK
        mReceiver = new DownloadCompleteReceiver();
        registerReceiver(mReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));

        //下载需要写SD卡权限, targetSdkVersion>=23 需要动态申请权限
        applyPermissions();

        return Service.START_STICKY;
    }
 
开发者ID:Jusenr,项目名称:AppFirCloud,代码行数:28,代码来源:DownLoadService.java

示例4: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Bundle args = getArguments();
    String title = "Sample";
    int layout = R.layout.fragment_list_from_bottom;
    if (args != null) {
        title = args.getString(SampleActivity.TITLE_KEY);
        layout = args.getInt(SampleActivity.LAYOUT_KEY);
    }

    ((SampleActivity) getActivity()).getSupportActionBar().setTitle(title);

    View view = inflater.inflate(layout, container, false);
    RecyclerView recyclerView = (AnimatedRecyclerView) view.findViewById(R.id.recycler_view);
    recyclerView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    recyclerView.scheduleLayoutAnimation();

    return view;
}
 
开发者ID:MLSDev,项目名称:AnimatedRecyclerView,代码行数:22,代码来源:SampleFragment.java

示例5: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
  if (state != null) {
    Bundle bundle = (Bundle) state;
    bundle.setClassLoader(loader);
    mSavedState.clear();
    mFragments.clear();

    String lastMode = bundle.getString("mode", "");
    if (!mode.equals(lastMode)) {
      cleanupOldFragments(bundle);
      return;
    }

    Parcelable[] fss = bundle.getParcelableArray("states");
    if (fss != null) {
      for (Parcelable fs : fss) {
        mSavedState.add((Fragment.SavedState) fs);
      }
    }
    Iterable<String> keys = bundle.keySet();
    for (String key : keys) {
      if (key.startsWith("f")) {
        int index = Integer.parseInt(key.substring(1));
        Fragment f = mFragmentManager.getFragment(bundle, key);
        if (f != null) {
          while (mFragments.size() <= index) {
            mFragments.add(null);
          }
          f.setMenuVisibility(false);
          mFragments.set(index, f);
        } else {
          Timber.w("Bad fragment at key %s", key);
        }
      }
    }
  }
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:39,代码来源:FragmentStatePagerAdapter.java

示例6: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String url = "";
    String name = "";

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();

    if (extras != null) {
        if (extras.containsKey(URL_FIELD) && extras.containsKey(NAME_FIELD)) {
            url = extras.getString(URL_FIELD);
            name = extras.getString(NAME_FIELD);
        } else {
            finish();
        }
    } else {
        finish();
    }

    Log.v("Installing shortcut", url + ", " + name);
    Intent shortcutIntent = new Intent(getApplicationContext(), ShortcutActivity.class);
    shortcutIntent.putExtra("start_url", url);
    shortcutIntent.setAction(Intent.ACTION_MAIN);
    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
            Intent.ShortcutIconResource.fromContext(getApplicationContext(),
                    R.mipmap.ic_launcher));
    addIntent.setAction(ACTION);
    getApplicationContext().sendBroadcast(addIntent);

    finish();
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:37,代码来源:CustomShortcutActivity.java

示例7: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_editor);
    setSupportActionBar(mBinding.toolbar);

    String fileName = "untitled.json";
    Bundle bundle = getIntent().getExtras();
    if (bundle != null && bundle.getString(FILENAME) != null) {
        fileName = bundle.getString(FILENAME);
    }

    mViewModel = new DocumentViewModel(this, fileName);
    mViewModel.loadDocument();

    mBinding.setViewModel(mViewModel);


    // Do some necessary non-data binding view work

    // TaskDescription constructor requires us to specify an overview title bar color, so we
    // grab primary color to match the original color
    int primaryColor = getColor(R.color.colorPrimary);
    ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
            mViewModel.getPrettyFileName(), null, primaryColor
    );

    // Set our overview task description with custom name matching the current doc file name
    setTaskDescription(td);

    mLayerTypePopup = new PopupMenu(this, mBinding.addLayerBtn);
    mLayerTypePopup.getMenuInflater().inflate(
            R.menu.menu_layer_types, mLayerTypePopup.getMenu());
    mLayerTypePopup.setOnMenuItemClickListener(mViewModel.getOnMenuItemClickListener());

    registerForContextMenu(mBinding.documentView);
    registerForContextMenu(mBinding.layerList);
}
 
开发者ID:google,项目名称:spline,代码行数:39,代码来源:EditorActivity.java

示例8: onPageStateRestored

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onPageStateRestored(Pager.Page page, List<Object> restoredElements, Bundle state) {
    super.onPageStateRestored(page, restoredElements, state);
    String prefix = "__page:"+page.getPageNumber()+":";
    int count = state.getInt(prefix+"placeholderCount", 0);
    if (count == 0) return;
    for (int i = 0; i < restoredElements.size() + count; i++) {
        String is = state.getString(prefix+"pos:"+i+":placeholder", null);
        if (is == null) continue;
        Placeholder placeholder = Placeholder.valueOf(is);
        restoredElements.add(i, placeholder);
    }
}
 
开发者ID:natario1,项目名称:Elements,代码行数:14,代码来源:BaseSource.java

示例9: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.webdatauploadlist);

    Bundle extras = getIntent().getExtras();
    user = extras.getString(PREFS_KEY_USER);
    pwd = extras.getString(PREFS_KEY_PWD);
    url = extras.getString(PREFS_KEY_URL);
    databases = extras.getStringArray(DATABASE_ID);

    refreshList();
}
 
开发者ID:gvSIGAssociation,项目名称:gvsig-mobile,代码行数:13,代码来源:SpatialiteExporterActivity.java

示例10: initData

import android.os.Bundle; //导入方法依赖的package包/类
private void initData() {
    Bundle bundle = getIntent().getExtras();
    story_id = String.valueOf(bundle.getInt(Constants.BUNDLE_KEY_ID));
    String title = bundle.getString(Constants.BUNDLE_KEY_TITLE);
    loadZhihuStory();
    mToolbarTitle.setText(title);
    mToolbarTitle.setSelected(true);
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:9,代码来源:ZhihuStoryInfoActivity.java

示例11: onReceive

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    Log.d(THIS_FILE, "Rewriter receive");
    Bundle resolvedInfos = getResultExtras(true);
    result = resolvedInfos.getString(Intent.EXTRA_PHONE_NUMBER);
    Log.d(THIS_FILE, "Rewriter receive : " + result);
    runSemaphore.release();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:9,代码来源:RewriterPlugin.java

示例12: handleMessage

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
    try {
        Bundle extras = msg.getData();

        if (extras != null) {
            final String animeURL = extras.getString(Constants.ANIME_URL);
            int mType = Parser.getTypeByURL(animeURL);
            WriteLog.appendLog(mTag, "parsing " + animeURL);
            if (mType == -1)
                return;

            showNotification(animeURL);
            mParser = Parser.getExistingInstance(mType);
            if (Parser.isDeadSource(mParser)) {
                if (MAVApplication.getInstance().getRepository().isFavorite(animeURL)) {
                    FavoriteRecord lRecord = MAVApplication.getInstance().getRepository().getFavoriteByAnimeUrl(animeURL);
                    MAVApplication.getInstance().getRepository().deleteFavorite(animeURL);
                }
                return;
            }
            if (mParser.isCloudFlareDDOSEnabled) {
                webview = new WebView(mService.get());
                WebSettings websettings = webview.getSettings();
                websettings.setJavaScriptEnabled(true);
                webview.setWebViewClient(new ParserWebClient(animeURL));
                webview.loadUrl(mParser.getServerUrl());
            } else {
                parseData(animeURL);
            }
        }
    } finally {
        PowerManager.WakeLock lock = getLock(mContext);

        if (lock.isHeld()) {
            lock.release();
        }
    }
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:40,代码来源:ParseAnimeService.java

示例13: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    preference = (BlacklistPreference) getPreference();
    if (savedInstanceState == null) {
        currentValue = preference.getValue();
    } else {
        currentValue = savedInstanceState.getString(VALUE);
    }
}
 
开发者ID:steevp,项目名称:UpdogFarmer,代码行数:11,代码来源:BlacklistDialog.java

示例14: onCreateLoader

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    switch (id) {
        case RECOMMENDED_VIDEOS_LOADER: // Fall through.
        case QUEUE_VIDEOS_LOADER: {
            String category = args.getString(VideoContract.VideoEntry.COLUMN_CATEGORY);
            return new CursorLoader(
                    getActivity(),
                    VideoContract.VideoEntry.CONTENT_URI,
                    null, // Projection to return - null means return all fields.
                    VideoContract.VideoEntry.COLUMN_CATEGORY + " = ?",
                    // Selection clause is category.
                    new String[]{category}, // Select based on the category.
                    null // Default sort order
            );
        }
        default: {
            // Loading a specific video.
            String videoId = args.getString(VideoContract.VideoEntry._ID);
            return new CursorLoader(
                    getActivity(),
                    VideoContract.VideoEntry.CONTENT_URI,
                    null, // Projection to return - null means return all fields.
                    VideoContract.VideoEntry._ID + " = ?", // Selection clause is id.
                    new String[]{videoId}, // Select based on the id.
                    null // Default sort order
            );
        }
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:31,代码来源:PlaybackOverlayFragment.java

示例15: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    if (args != null) {
        mID = args.getString("mID");
    }
}
 
开发者ID:xiarunhao123,项目名称:PureNews,代码行数:9,代码来源:VideoFragment.java


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