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


Java Bundle类代码示例

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


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

示例1: onCreateView

import android.os.Bundle; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    // Create an ad request. Check logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
    mAdView.loadAd(adRequest);
    return root;

}
 
开发者ID:changja88,项目名称:Udacity_Gradle,代码行数:17,代码来源:MainActivityFragment.java

示例2: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler_view);

    datas = new ArrayList<>();

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(mAdapter = new HomeAdapter());

    getCategoryData();
    getCategoryData();
    getCategoryData();

    mAdapter.notifyDataSetChanged();
}
 
开发者ID:open-android,项目名称:labelview,代码行数:18,代码来源:RecyclerViewActivity.java

示例3: onActivityResult

import android.os.Bundle; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
        if (Build.VERSION.SDK_INT >= 23 && !Settings.canDrawOverlays(this)) {
            //SYSTEM_ALERT_WINDOW permission not granted...
            Toast.makeText(this, "Permission Denied by user.", Toast.LENGTH_SHORT)
                    .show();
            mSwSms.setChecked(false);
            ShareUtil.putBoolean(this, "isSms", mSwSms.isChecked());
        } else {
            Toast.makeText(this, "Permission allowed", Toast.LENGTH_SHORT).show();
            mSwSms.setChecked(true);
            ShareUtil.putBoolean(this, "isSms", mSwSms.isChecked());
        }
    } else if (requestCode == QRCODE_RESULT) {
        if (resultCode == RESULT_OK) {
            Bundle bundle = data.getExtras();
            String scanResult = bundle.getString("result");
            mScanResult.setText(scanResult);
        }
    }
}
 
开发者ID:Hultron,项目名称:LifeHelper,代码行数:23,代码来源:SettingActivity.java

示例4: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try{
        DBHandler dbHandler = new DBHandler(getActivity());
        liftNames = dbHandler.listAllTables();
        DBHandler currentTable;
        int value;
        for(String liftName: liftNames){
            currentTable = new DBHandler(getActivity(), liftName);
            currMaxes = currentTable.getAllItems();
            value = MaxesAdapter.findLastValue(currentTable, liftName);
            if(value != -1){
                MaxesCard newMax = new MaxesCard(createTitle(liftName), value);
                list.add(newMax);
            }
        }
        dbHandler.close();
    }
    catch (Exception e){

    }
}
 
开发者ID:Durian-Inc,项目名称:SwolyV2,代码行数:24,代码来源:MaxesFragment.java

示例5: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_home_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.activity_home_toolbar_title);

    mViewpager = (ViewPager) findViewById(R.id.activity_home_viewpager);
    mTabLayout = (TabLayout) findViewById(R.id.activity_home_tab_layout);
    mFab = (FloatingActionButton) findViewById(R.id.activity_home_fab);
    mFab.setOnClickListener(this);

    setupViewPagerAndTabLayout();
    //startNotificationService();
}
 
开发者ID:abicelis,项目名称:Remindy,代码行数:17,代码来源:HomeActivity.java

示例6: setupServiceReceiver

import android.os.Bundle; //导入依赖的package包/类
public void setupServiceReceiver() {
    mReceiver = new DownloadResultReceiver(new Handler());
    Intent intent = new Intent(getApplicationContext(), DownloadService.class);
    intent.putExtra("receiver", mReceiver);
    if(!PreferenceHelper.isSynced(getApplicationContext())) {
        startService(intent);
    }
    // This is where we specify what happens when data is received from the
    // service
    mReceiver.setReceiver(new DownloadResultReceiver.Receiver() {
        @Override
        public void onReceiveResult(int resultCode, Bundle resultData) {
            if (resultCode == RESULT_OK) {
                String resultValue = resultData.getString("resultValue");
                Toast.makeText(MainActivity.this, resultValue, Toast.LENGTH_SHORT).show();
            }
        }
    });
}
 
开发者ID:andy1729,项目名称:FuelFriend,代码行数:20,代码来源:MainActivity.java

示例7: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_modos_russa);

    botaoVoltar = (Button) findViewById(R.id.botaoVoltarRussa_6);


    botaoVoltar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent intent = new Intent(ModosRussaActivity.this, RussaActivity.class);
            startActivity(intent);
            finish();
        }
    });

}
 
开发者ID:FilipeAlbuquerque,项目名称:EletroFisio,代码行数:20,代码来源:ModosRussaActivity.java

示例8: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
//                        .setAction("Action", null).show();
                showActionSheet();
            }
        });

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:27,代码来源:MainActivity.java

示例9: save

import android.os.Bundle; //导入依赖的package包/类
/**
 * Persists all supported data types present in the passed in Bundle, to the
 * cache
 *
 * @param bundle
 *          The Bundle containing information to be cached
 */
public void save(Bundle bundle) {
    Validate.notNull(bundle, "bundle");

    SharedPreferences.Editor editor = cache.edit();

    for (String key : bundle.keySet()) {
        try {
            serializeKey(key, bundle, editor);
        } catch (JSONException e) {
            // Error in the bundle. Don't store a partial cache.
            Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e);

            // Bypass the commit and just return. This cancels the entire edit transaction
            return;
        }
    }

    boolean successfulCommit = editor.commit();
    if (!successfulCommit) {
        Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful");
    }
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:30,代码来源:SharedPreferencesTokenCachingStrategy.java

示例10: onCreateView

import android.os.Bundle; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_click, container, false);

    if (null != savedInstanceState) {
        mClickCounter = savedInstanceState.getParcelable(CLICK_COUNT_TAG);
    } else {
        mClickCounter = new ClickCounter();
    }

    mTextView = (TextView) rootView.findViewById(R.id.click_count_text_view);
    displayClickCount();
    Button button = (Button) rootView.findViewById(R.id.click_button);
    button.setOnClickListener(mListener);
    return rootView;
}
 
开发者ID:changja88,项目名称:Udacity_Gradle,代码行数:18,代码来源:ClickFragment.java

示例11: onCreateView

import android.os.Bundle; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
	
    View v = inflater.inflate(R.layout.fragment_exit, container, false);
    
    mSharedPreferences = getActivity().getSharedPreferences(
      	      "org.greenstand.android", Context.MODE_PRIVATE);

    Button yesBtn = (Button) v.findViewById(R.id.fragment_exit_yes);
    yesBtn.setOnClickListener(ExitFragment.this);

    Button noBtn = (Button) v.findViewById(R.id.fragment_exit_no);
    noBtn.setOnClickListener(ExitFragment.this);
    
    return v;
}
 
开发者ID:Greenstand,项目名称:treetracker-android,代码行数:18,代码来源:ExitFragment.java

示例12: writeToParcel

import android.os.Bundle; //导入依赖的package包/类
@Override
public void writeToParcel(final Parcel parcel, final int arg1) {
    final Bundle b = new Bundle(getClass().getClassLoader());

    b.putByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD, mScanRecord);

    b.putInt(PARCEL_EXTRA_FIRST_RSSI, mFirstRssi);
    b.putInt(PARCEL_EXTRA_CURRENT_RSSI, mCurrentRssi);

    b.putLong(PARCEL_EXTRA_FIRST_TIMESTAMP, mFirstTimestamp);
    b.putLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, mCurrentTimestamp);

    b.putParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE, mDevice);
    b.putParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE, mRecordStore);
    b.putSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG, (Serializable) mRssiLog);

    parcel.writeBundle(b);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:19,代码来源:BluetoothLeDevice.java

示例13: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
@SuppressLint("NewApi")
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // External storage permissions
    if (Build.VERSION.SDK_INT < 23) {
        Log.d(TAG, "Don't need permissions.");
    } else {
        if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
            if (shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE)) {
                Log.d(TAG, "PERMISSIONS: App needs permissions to read external storage.");
            }
            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
        }
    }

    // Create directory for files if it does not exist
    File musicFolder = new File(Environment.getExternalStorageDirectory() + File.separator + MUSIC_DIR_NAME);
    if (!musicFolder.exists()) {
        musicFolder.mkdir();
    }

    // Get shared prefs
    sharedPreferences = getSharedPreferences("com.lunchareas.divertio", MODE_PRIVATE);
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:27,代码来源:MainActivity.java

示例14: onCreate

import android.os.Bundle; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_b);
    mActivityName = getString(R.string.activity_b_label);
    mStatusView = (TextView)findViewById(R.id.status_view_b);
    mStatusAllView = (TextView)findViewById(R.id.status_view_all_b);
    mStatusTracker.setStatus(mActivityName, getString(R.string.on_create));
    Utils.printStatus(mStatusView, mStatusAllView);
}
 
开发者ID:kandroid,项目名称:AndroidLifecycleSample,代码行数:11,代码来源:ActivityB.java

示例15: onCreate

import android.os.Bundle; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dream);
    StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
	lvDream = forceCast(findViewById(R.id.lvDream));
	etDream = forceCast(findViewById(R.id.etDream));
	etDream.setText(R.string.dream_api_example);
	findViewById(R.id.btnSearch).setOnClickListener(this);

	dreamList = new ArrayList<HashMap<String,Object>>();
	adapter = new DreamSimpleAdapter(this, dreamList);
	lvDream.setAdapter(adapter);
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:14,代码来源:DreamAPIActivity.java


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