List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:com.ateam.alleneatonautorentals.SalesSearchUser.java
@Override public void onBackPressed() { Intent ii = new Intent(SalesSearchUser.this, MainMenu.class); Bundle b = new Bundle(); b.putString("employeeType", "Sales"); ii.putExtras(b); startActivity(ii);/*www.ja va 2s . c om*/ finish(); }
From source file:com.eusecom.attendance.IntsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ints); //showProgressDialog(); // Create the adapter that will return a fragment for each section mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { private final Fragment[] mFragments = new Fragment[] { new MyIntsFragment(), new MyIntsFragment(), new MyIntsFragment(), }; private final String[] mFragmentNames = new String[] { "Interruptions", "Next", "Next" }; @Override//from w ww. j av a2 s . com public Fragment getItem(int position) { return mFragments[position]; } @Override public int getCount() { return mFragments.length; } @Override public CharSequence getPageTitle(int position) { return mFragmentNames[position]; } }; // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); // Button launches NewPostActivity findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(IntsActivity.this, NewPostActivity.class); Bundle extras = new Bundle(); extras.putString("editx", "0"); extras.putString("keyx", "0"); i.putExtras(extras); startActivity(i); } }); //hideProgressDialog(); }
From source file:com.joda.tentatime.FindExamActivity.java
private void setupWidgets() { Button btn = (Button) findViewById(R.id.searchB); btn.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . j a v a 2 s. c o m*/ public void onClick(View v) { DownloadJsonTask task = new DownloadJsonTask(); task.execute(userChoice(mGetExam.getText().toString())); } }); mGetExam = (EditText) findViewById(R.id.getExam); examsView = (ListView) findViewById(R.id.examsLV); examsView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(FindExamActivity.this, Result.class); Bundle b = new Bundle(); b.putSerializable("key", (Serializable) results.get(position)); intent.putExtras(b); //deliver the exam to the next Intent startActivityForResult(intent, 1); } }); // CAST THE LINEARLAYOUT HOLDING THE MAIN PROGRESS (SPINNER) //linlaHeaderProgress = (LinearLayout) findViewById(R.id.linlaHeaderProgress); }
From source file:be.evias.cloudLogin.cloudLoginMainActivity.java
@Override public void onNavigationDrawerItemSelected(final int position) { if (position == NAVIGATION_LOGOUT) /* log out mAccount. */ logoutAccount(mAccount);// w ww .ja va2 s . c o m else { /* open page */ new AsyncTask<String, Void, Intent>() { @Override protected Intent doInBackground(String... params) { Bundle data = new Bundle(); try { SharedPreferences sp = getBaseContext().getSharedPreferences("cloudlogin", Context.MODE_PRIVATE); String name = sp.getString("cloudlogin_active_account_name", ""); mCurrentUser = sServerAuthenticate.getUserObject(getBaseContext(), name); if (mCurrentUser == null) throw new Exception("Could not retrieve User Object (Server Error)."); } catch (Exception e) { Log.d("cloudLogin", "cloudloginMainActivity/onNavigationDrawerItemSelected: getUserObject error."); e.printStackTrace(); } final Intent res = new Intent(); res.putExtras(data); return res; } @Override protected void onPostExecute(Intent intent) { if (mCurrentUser != null) { FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, cloudLoginPageFragment.createPage(position, mCurrentUser)) .commit(); } } }.execute(); } }
From source file:com.geekandroid.sdk.base.BaseActivity.java
public void startActivity(Class<?> cls, Bundle extras) { Intent intent = new Intent(this, cls); intent.putExtras(extras); startActivity(intent);//from www .j ava 2s.c o m }
From source file:com.geekandroid.sdk.base.BaseActivity.java
public void startActvityForResult(Class<?> cls, int requestCode, Bundle extras) { Intent intent = new Intent(this, cls); intent.putExtras(extras); startActivityForResult(intent, requestCode); }
From source file:com.eusecom.attendance.DatabaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_database); //showProgressDialog(); // Create the adapter that will return a fragment for each section mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { private final Fragment[] mFragments = new Fragment[] { new RecentPostsFragment(), new MyPostsFragment(), new MyTopPostsFragment(), }; private final String[] mFragmentNames = new String[] { "Recent", "My Posts", "My Top Posts" }; @Override/* w ww . jav a2 s .com*/ public Fragment getItem(int position) { return mFragments[position]; } @Override public int getCount() { return mFragments.length; } @Override public CharSequence getPageTitle(int position) { return mFragmentNames[position]; } }; // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); // Button launches NewPostActivity findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(DatabaseActivity.this, NewPostActivity.class); Bundle extras = new Bundle(); extras.putString("editx", "0"); extras.putString("keyx", "0"); i.putExtras(extras); startActivity(i); } }); //hideProgressDialog(); }
From source file:com.basesmartframe.pickphoto.PickPhotosPreviewFragment.java
public void initViews(View view) { Bundle bundle = getArguments();//from w ww . j av a 2 s . c o m if (bundle != null) { mMaxImageNum = bundle.getInt(PickPhotosFragment.MAX_IMAGE_NUM, 4); mCanChooseImage = bundle.getBoolean(CAN_CHOOSE_IMAGE, true); mChoosedData = getPhotoListFromArg(bundle, CHOOSE_DATA_LIST); mCurPhotoIndex = bundle.getInt(INDEX, 0); } mImageIndexText = (TextView) view.findViewById(R.id.image_index_tv); mSelectLayout = view.findViewById(R.id.select_layout); mViewPager = (ViewPager) view.findViewById(R.id.viewpager); mSelectCheckBox = (CheckBox) view.findViewById(R.id.select_checkbox); mSelectCheckBox.setClickable(false); mBottomBar = view.findViewById(R.id.bottom_bar); mComplete = (Button) view.findViewById(R.id.pick_complete); mComplete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundles = new Bundle(); bundles.putSerializable(CHOOSE_DATA_LIST, mChoosedData); Intent data = new Intent(); data.putExtras(bundles); getActivity().setResult(PickPhotosFragment.RESULT_COMPLETE, data); getActivity().finish(); } }); view.findViewById(R.id.pick_back).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); } }); if (!mCanChooseImage) { mSelectLayout.setVisibility(View.GONE); mComplete.setVisibility(View.GONE); mBottomBar.setVisibility(View.GONE); } mAdapter = new ViewPagerAdapter(getActivity()); mViewPager.setAdapter(mAdapter); mViewPager.setBackgroundColor(0xFF000000); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { updateCheckbox(arg0); updatePhotoIndex(arg0); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); mViewPager.setCurrentItem(mCurPhotoIndex); updateCheckbox(mCurPhotoIndex); updatePhotoIndex(mCurPhotoIndex); updateCompleteBtn(); mSelectLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mImageGroupData == null) return; int current = mViewPager.getCurrentItem(); ImageBean bean = mImageGroupData.get(current); if (mSelectCheckBox.isChecked()) { mSelectCheckBox.setChecked(false); mChoosedData.remove(bean); } else { if (mChoosedData.size() >= mMaxImageNum) { mSelectCheckBox.setChecked(false); SFToast.showToast(getString(R.string.four_pics_most, mMaxImageNum)); return; } File file = new File(bean.getPath()); if (!file.exists()) { mSelectCheckBox.setChecked(false); SFToast.showToast(R.string.photo_donot_exist); return; } mChoosedData.add(bean); mSelectCheckBox.setChecked(true); } updateCompleteBtn(); } }); mAdapter.notifyDataSetChanged(); }
From source file:com.example.jinux.mydemo.s3.UploadService.java
private void broadcastState(String s3key, int percent, String msg) { Intent intent = new Intent(UPLOAD_STATE_CHANGED_ACTION); Bundle b = new Bundle(); b.putString(S3KEY_EXTRA, s3key);/*from w w w . ja v a 2 s . c o m*/ b.putInt(PERCENT_EXTRA, percent); b.putString(MSG_EXTRA, msg); intent.putExtras(b); sendBroadcast(intent); }
From source file:gov.wa.wsdot.android.wsdot.ui.MountainPassItemCameraFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Bundle b = new Bundle(); Intent intent = new Intent(getActivity(), CameraActivity.class); b.putInt("id", bitmapImages.get(position).getCameraId()); intent.putExtras(b); startActivity(intent);/*w ww . j a v a 2s.c o m*/ }