List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:org.openremote.android.console.util.AsyncResourceLoader.java
/** * Finish downloading and forward to different view by result. * //from w w w . j a va 2 s.c o m * @see android.os.AsyncTask#onPostExecute(java.lang.Object) */ @Override protected void onPostExecute(AsyncResourceLoaderResult result) { publishProgress("groups & screens"); Intent intent = new Intent(); switch (result.getAction()) { case TO_GROUP: intent.setClass(activity, GroupActivity.class); if (result.isCanUseLocalCache()) { intent.setData(Uri.parse(ControllerException.exceptionMessageOfCode(result.getStatusCode()))); } break; case TO_LOGIN: intent.setClass(activity, LoginViewActivity.class); intent.setData(Uri.parse(Main.LOAD_RESOURCE)); break; case TO_SETTING_SSL_PROTOCOL_ERROR: //If the host is in the keystore, delete it. It is obviously invalid. orKeyStore.deleteHost(AppSettingsModel.getCurrentServer(activity)); intent.setClass(activity, AppSettingsActivity.class); intent.putExtra("SSL_CLIENT_PROTOCOL", true); break; case TO_SETTING_SSL_ERROR: //If the host is in the keystore, delete it. It is obviously invalid. orKeyStore.deleteHost(AppSettingsModel.getCurrentServer(activity)); intent.setClass(activity, AppSettingsActivity.class); intent.putExtra("SSL_CLIENT", true); break; case SWITCH_TO_OTHER_CONTROLER: ORControllerServerSwitcher.doSwitch(activity); return; default: ViewHelper.showAlertViewWithTitle(activity, "Send Request Error", ControllerException.exceptionMessageOfCode(result.getStatusCode())); return; } activity.startActivity(intent); activity.finish(); }
From source file:com.starwood.anglerslong.LicenseActivity.java
/********************************************************* * Gives functionality to the action bar *********************************************************/ public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(); switch (item.getItemId()) { case R.id.add: if (numItems <= 5) { intent.setClass(getApplicationContext(), LicenseAddActivity.class); intent.putExtra("title", "License"); intent.putExtra("isPopulated", isLicensePopulated); intent.putExtra("isArrayEmpty", isArrayEmpty); intent.putExtra("isLicense", true); startActivity(intent);// w w w. j a va 2 s . co m } else { Toast.makeText(getApplicationContext(), "You cannot have more than 5 licenses", Toast.LENGTH_SHORT) .show(); } return true; case R.id.delete: if (isLicensePopulated && !isArrayEmpty) { isDeletable = true; Toast.makeText(getApplicationContext(), "Please click the item you would like to delete", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "There's nothing to delete. Please Add an item first.", Toast.LENGTH_SHORT).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.example.dell.chihuobao.fragment.SettingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { hashMap = user.getUser();//from w w w. java2 s. co m View view = inflater.inflate(R.layout.setting, container, false); restaurant_icon = (ImageView) view.findViewById(R.id.restaurant_icon); tv_restaurant_name = (TextView) view.findViewById(R.id.tv_restaurant_name); tv_owner_phone = (TextView) view.findViewById(R.id.tv_owner_phone); tv_owner_cardnumber = (TextView) view.findViewById(R.id.tv_owner_cardnumber); shopmessage = (TextView) view.findViewById(R.id.shopmessage); if (MyApplication.getUser().getUser().get("name") != null) { tv_restaurant_name.setText(MyApplication.getUser().getUser().get("name").toString()); } if (MyApplication.getUser().getUser().get("phone") != null) { tv_owner_phone.setText(MyApplication.getUser().getUser().get("phone").toString()); } if (MyApplication.getUser().getUser().get("identify") != null) { tv_owner_cardnumber .setText(getDisplayStr(MyApplication.getUser().getUser().get("identify").toString())); } RelativeLayout about_us_layout = (RelativeLayout) view.findViewById(R.id.about_us_layout); about_us_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), FeedBackActivity.class); startActivity(intent); } }); RelativeLayout locationUpdate = (RelativeLayout) view.findViewById(R.id.location); locationUpdate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), LocationActivity.class); startActivity(intent); } }); RelativeLayout app_recommend_layout = (RelativeLayout) view.findViewById(R.id.app_recommend_layout); app_recommend_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), HelpActivity.class); startActivity(intent); } }); RelativeLayout app_password_layout = (RelativeLayout) view.findViewById(R.id.app_password_layout); app_password_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), PhoneVerifyActivity.class); startActivity(intent); } }); TextView settings_logout = (TextView) view.findViewById(R.id.settings_logout); settings_logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new AlertDialog.Builder(getActivity()).setTitle("??").setMessage("") .setPositiveButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { clearUser(); Intent intent = new Intent(getActivity(), LoginActivity.class); startActivity(intent); getActivity().finish(); } }).setNegativeButton("?", null).show(); } }); LinearLayout restaurant_info_container = (LinearLayout) view.findViewById(R.id.restaurant_info_container); restaurant_info_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /*startActivity(new Intent(getActivity(), UserModifyActivity.class));*/ startActivity(new Intent(getActivity(), UserUpdateActivity.class)); } }); if (hashMap.get("shopmessage") != null) { shopmessage.setText(hashMap.get("shopmessage").toString()); } LinearLayout shopmessage_layout = (LinearLayout) view.findViewById(R.id.shopmessage_layout); shopmessage_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final EditText editText = new EditText(getActivity()); editText.setText(hashMap.get("shopmessage").toString()); new AlertDialog.Builder(getActivity()).setTitle("?").setView(editText) .setPositiveButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String text = editText.getText().toString().trim(); shopmessage.setText(text); hashMap.put("shopmessage", text); updateUser(hashMap); } }).setNegativeButton("?", null).show(); } }); Thread thread = new Thread(new Runnable() { @Override public void run() { downloadBitmap(UserModifyActivity.URL + MyApplication.getUser().getUser().get("shopphoto").toString().replaceAll("\\\\", "/")); } } ); thread.start(); /* SettingsItemView settings_connect_manager= (SettingsItemView) view.findViewById(R.id.settings_connect_manager); settings_connect_manager.setOnSettingClickListener(new SettingsItemView.settingClickListener() { @Override public void rightClick() { Toast.makeText(getActivity(), "a", Toast.LENGTH_SHORT).show(); } });*/ return view; }
From source file:com.android.managedprovisioning.DeviceOwnerProvisioningService.java
private void onProvisioningSuccess() { // Copying an account needs to happen late in the provisioning process to allow the current // user to be started, but before we tell the MDM that provisioning succeeded. maybeCopyAccount();/*from ww w .j a v a 2 s .c o m*/ if (DEBUG) ProvisionLogger.logd("Reporting success."); mDone = true; // Set DPM userProvisioningState appropriately and persists mParams for use during // FinalizationActivity if necessary. mUtils.markUserProvisioningStateInitiallyDone(this, mParams); Intent successIntent = new Intent(ACTION_PROVISIONING_SUCCESS); successIntent.setClass(this, DeviceOwnerProvisioningActivity.ServiceMessageReceiver.class); LocalBroadcastManager.getInstance(this).sendBroadcast(successIntent); // Wait for stopService() call from the activity. }
From source file:com.rubika.aotalk.aou.FragmentCalendar.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Intent intent = new Intent(); intent.setClass(mAdapter.getContext(), ActivityCalendar.class); intent.putExtra("title", mAdapter.getItem(position).getLabel()); intent.putExtra("date", mAdapter.getItem(position).getTime()); intent.putExtra("text", mAdapter.getItem(position).getDescription()); intent.putExtra("link", "http://www.ao-universe.com/forum/viewtopic.php?t=" + mAdapter.getItem(position).getTopic()); if (AOU.isTablet) { aou.loadFragment(intent, 3);//from www . j a va2 s .com } else { mAdapter.getContext().startActivity(intent); } }
From source file:com.miz.mizuu.fragments.MovieDiscoveryFragment.java
@Override public void onViewCreated(View v, Bundle savedInstanceState) { super.onViewCreated(v, savedInstanceState); mProgressBar = (ProgressBar) v.findViewById(R.id.progress); mProgressBar.setVisibility(View.GONE); mAdapter = new ImageAdapter(getActivity()); mGridView = (ObservableGridView) v.findViewById(R.id.gridView); mGridView.setAdapter(mAdapter);// w w w . j av a 2 s . c o m mGridView.setColumnWidth(mImageThumbSize); // Calculate the total column width to set item heights by factor 1.5 mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mAdapter.getNumColumns() == 0) { final int numColumns = (int) Math .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing)); if (numColumns > 0) mAdapter.setNumColumns(numColumns); MizLib.removeViewTreeObserver(mGridView.getViewTreeObserver(), this); } } }); mGridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent i = new Intent(); if (mMovieMap.get(Integer.valueOf(mMovies.get(arg2).getId()))) { i.setClass(getActivity(), MovieDetails.class); i.putExtra("tmdbId", mMovies.get(arg2).getId()); } else { i.setClass(getActivity(), TMDbMovieDetails.class); i.putExtra("tmdbId", mMovies.get(arg2).getId()); i.putExtra("title", mMovies.get(arg2).getTitle()); } ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), arg1.findViewById(R.id.cover), "cover"); ActivityCompat.startActivity(getActivity(), i, options.toBundle()); } }); if (getArguments().containsKey("json")) { mJson = getArguments().getString("json"); mBaseUrl = getArguments().getString("baseUrl"); loadJson(); } }
From source file:com.rubika.aotalk.towerwars.FragmentAttacks.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { Intent intent = new Intent(); intent.setClass(mAdapter.getContext(), Map.class); intent.putExtra("name", mAdapter.getItem(position).getSitename()); intent.putExtra("zone", mAdapter.getItem(position).getZone()); intent.putExtra("x", mAdapter.getItem(position).getX()); intent.putExtra("y", mAdapter.getItem(position).getY()); mAdapter.getContext().startActivity(intent); }
From source file:com.inde.shiningdays.MainActivity.java
private void startUpdateWidgetService() { Intent i = new Intent(); i.setClass(this, UpdateWidgetService.class); startService(i);/*from ww w. j av a 2 s .c o m*/ }
From source file:org.deviceconnect.android.uiapp.DConnectActivity.java
/** * ??./*from www.j a v a2s . co m*/ */ private void openPluginList() { Intent intent = new Intent(); intent.setClass(this, PluginListActivity.class); startActivity(intent); }
From source file:com.kayzook.bracediary.BaseActivity.java
public void jumpToProfile(View view) { Intent intent = new Intent(); intent.setClass(this, UserEditProfileActivityFragment.class); startActivity(intent); // update selected item and title, then close the drawer mDrawerLayout.closeDrawer(mDrawer);//w w w .j ava 2 s . c o m }