List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.appdynamics.demo.gasp.activity.PlacesDetailActivity.java
private void addGaspReview() { try {/*from w w w . ja va 2 s . c o m*/ Intent intent = new Intent(); intent.setClass(this, ReviewActivity.class); intent.putExtra(ReviewActivity.REVIEW_RESTAURANT_NAME, mPlaceDetail.getName()); intent.putExtra(ReviewActivity.REVIEW_RESTAURANT_ID, mGaspRestaurantId); intent.putExtra(ReviewActivity.REVIEW_REFERENCE, mPlacesReference); startActivityForResult(intent, 0); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.engine.privatefood.activity.ImagesGridActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_images_grid); androidImagePicker = AndroidImagePicker.getInstance(); androidImagePicker.clearSelectedImages();//most of the time you need to clear the last selected images or you can comment out this line mBtnOk = (TextView) findViewById(R.id.btn_ok); mBtnOk.setOnClickListener(this); if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_SINGLE) { mBtnOk.setVisibility(View.GONE); } else {// ww w . ja va 2s. c o m mBtnOk.setVisibility(View.VISIBLE); } findViewById(R.id.btn_backpress).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); final boolean isCrop = getIntent().getBooleanExtra("isCrop", false); imagePath = getIntent().getStringExtra(AndroidImagePicker.KEY_PIC_PATH); mFragment = new ImagesGridFragment(); /*Bundle data = new Bundle(); data.putString(AndroidImagePicker.KEY_PIC_PATH,imagePath); mFragment.setArguments(data);*/ mFragment.setOnImageItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { position = androidImagePicker.isShouldShowCamera() ? position - 1 : position; if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_MULTI) { go2Preview(position); } else if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_SINGLE) { if (isCrop) { Intent intent = new Intent(); intent.setClass(ImagesGridActivity.this, ImageCropActivity.class); intent.putExtra(AndroidImagePicker.KEY_PIC_PATH, androidImagePicker.getImageItemsOfCurrentImageSet().get(position).path); startActivityForResult(intent, AndroidImagePicker.REQ_CAMERA); } else { androidImagePicker.clearSelectedImages(); androidImagePicker.addSelectedImageItem(position, androidImagePicker.getImageItemsOfCurrentImageSet().get(position)); setResult(RESULT_OK); finish(); } } } }); getSupportFragmentManager().beginTransaction().replace(R.id.container, mFragment).commit(); androidImagePicker.addOnImageSelectedListener(this); int selectedCount = androidImagePicker.getSelectImageCount(); onImageSelected(0, null, selectedCount, androidImagePicker.getSelectLimit()); }
From source file:com.mgfypy.imagelibrary.ui.activity.ImagesGridActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_images_grid); androidImagePicker = AndroidImagePicker.getInstance(); androidImagePicker.clearSelectedImages();//most of the time you need to clear the last selected images or you can comment out this line mBtnOk = (TextView) findViewById(R.id.btn_ok); mBtnOk.setOnClickListener(this); if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_SINGLE) { mBtnOk.setVisibility(View.GONE); } else {//ww w . j a va 2s.com mBtnOk.setVisibility(View.VISIBLE); } findViewById(R.id.btn_backpress).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); //final boolean isCrop = getIntent().getBooleanExtra("isCrop",false); final boolean isCrop = androidImagePicker.cropMode; imagePath = getIntent().getStringExtra(AndroidImagePicker.KEY_PIC_PATH); mFragment = new ImagesGridFragment(); /*Bundle data = new Bundle(); data.putString(AndroidImagePicker.KEY_PIC_PATH,imagePath); mFragment.setArguments(data);*/ mFragment.setOnImageItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { position = androidImagePicker.isShouldShowCamera() ? position - 1 : position; if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_MULTI) { go2Preview(position); } else if (androidImagePicker.getSelectMode() == AndroidImagePicker.Select_Mode.MODE_SINGLE) { if (isCrop) { Intent intent = new Intent(); intent.setClass(ImagesGridActivity.this, ImageCropActivity.class); intent.putExtra(AndroidImagePicker.KEY_PIC_PATH, androidImagePicker.getImageItemsOfCurrentImageSet().get(position).path); startActivity(intent); } else { androidImagePicker.clearSelectedImages(); androidImagePicker.addSelectedImageItem(position, androidImagePicker.getImageItemsOfCurrentImageSet().get(position)); setResult(RESULT_OK); finish(); androidImagePicker.notifyOnImagePickComplete(); } } } }); getSupportFragmentManager().beginTransaction().replace(R.id.container, mFragment).commit(); androidImagePicker.addOnImageSelectedChangeListener(this); int selectedCount = androidImagePicker.getSelectImageCount(); onImageSelectChange(0, null, selectedCount, androidImagePicker.getSelectLimit()); }
From source file:com.nxt.yn.app.ui.RobotsActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); MyApplication.getInstance().addActivity(this); setContentView(R.layout.em_fragment_robots); findViewById(R.id.layout_title).setBackgroundColor( ZPreferenceUtils.getPrefInt(Constant.SKIN_COLOR, getResources().getColor(R.color.title_color))); inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override//from ww w . ja v a 2 s. c o m public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }
From source file:com.longshihan.mvpretrofit.activity.im.RobotsActivity.java
@Override protected void initAllMembersView(Bundle savedInstanceState) { inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); ListView mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); if (android.os.Build.VERSION.SDK_INT >= 14) { swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); }/* ww w .jav a 2s.c o m*/ progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = DemoHelper.getInstance().getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); getRobotNamesFromServer(); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); }
From source file:com.engine.privatefood.activity.ImagesGridActivity.java
/** * ?/*from w ww. j av a 2s.c o m*/ * @param position */ private void go2Preview(int position) { Intent intent = new Intent(); intent.putExtra(AndroidImagePicker.KEY_PIC_SELECTED_POSITION, position); intent.setClass(ImagesGridActivity.this, ImagePreviewActivity.class); startActivityForResult(intent, AndroidImagePicker.REQ_PREVIEW); }
From source file:com.easemob.helpdeskdemo.ui.MainActivity.java
public void contactCustomer(View view) { switch (view.getId()) { case R.id.ll_setting_list_customer: Intent intent = new Intent(); intent.setClass(MainActivity.this, LoginActivity.class); intent.putExtra(Constant.MESSAGE_TO_INTENT_EXTRA, Constant.MESSAGE_TO_DEFAULT); startActivity(intent);/*from w w w . j a v a 2 s . c om*/ break; default: break; } }
From source file:com.sharky.RemovePurchaseFromQueuePurchase.java
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { String receipt = null;//from ww w .java2 s . co m try { receipt = arg1[1].getAsString(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (FRETypeMismatchException e) { e.printStackTrace(); } catch (FREInvalidObjectException e) { e.printStackTrace(); } catch (FREWrongThreadException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } if (receipt == null) { return null; } JSONObject object = null; try { object = new JSONObject(receipt); } catch (JSONException e) { e.printStackTrace(); } if (object == null) { return null; } String signedData = null; try { signedData = object.getString("signedData"); } catch (JSONException e) { e.printStackTrace(); } if (signedData == null) { return null; } JSONObject signedObject = null; try { signedObject = new JSONObject(signedData); } catch (JSONException e) { e.printStackTrace(); } if (signedObject == null) { return null; } Long nonce = 0L; try { nonce = signedObject.getLong("nonce"); } catch (JSONException e) { e.printStackTrace(); } JSONArray orders = null; try { orders = signedObject.getJSONArray("orders"); } catch (JSONException e) { e.printStackTrace(); } String[] notifyIds = new String[orders.length()]; for (int i = 0; i < orders.length(); i++) { JSONObject order = null; try { order = orders.getJSONObject(i); } catch (JSONException e) { e.printStackTrace(); } if (order == null) { continue; } try { notifyIds[i] = order.getString("notificationId"); } catch (JSONException e) { e.printStackTrace(); } } Intent intent = new Intent(Consts.ACTION_CONFIRM_NOTIFICATION); intent.setClass(arg0.getActivity(), BillingService.class); intent.putExtra(Consts.NOTIFICATION_ID, notifyIds); arg0.getActivity().startService(intent); Security.removeNonce(nonce); return null; }
From source file:com.app.khclub.base.easeim.activity.RobotsActivity.java
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.fragment_robots); inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mListView = (ListView) findViewById(R.id.list); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout); swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); progressBar = findViewById(R.id.progress_bar); swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override//from w ww. j a v a2 s . c om public void onRefresh() { getRobotNamesFromServer(); } }); Map<String, RobotUser> robotMap = ((KHHXSDKHelper) HXSDKHelper.getInstance()).getRobotList(); if (robotMap != null) { robotList.addAll(robotMap.values()); } else { progressBar.setVisibility(View.VISIBLE); } adapter = new RobotAdapter(this, 1, robotList); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RobotUser user = (RobotUser) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(RobotsActivity.this, ChatActivity.class); intent.putExtra("userId", user.getUsername()); startActivity(intent); } }); mListView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); getRobotNamesFromServer(); }
From source file:com.facebook.samples.rps.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.equals(settings)) { showFragment(SETTINGS, true);/* www . j a va 2 s .c o m*/ return true; } else if (item.equals(friends)) { Intent intent = new Intent(); intent.setClass(this, FriendActivity.class); startActivity(intent); return true; } else if (item.equals(share)) { RpsFragment fragment = (RpsFragment) fragments[RPS]; fragment.shareUsingNativeDialog(); return true; } else if (item.equals(message)) { RpsFragment fragment = (RpsFragment) fragments[RPS]; fragment.shareUsingMessengerDialog(); return true; } return false; }