List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:cn.scujcc.bug.bitcoinplatformandroid.fragment.CandlestickChartsFragment.java
@Nullable @Override//from ww w. ja va 2 s . com public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_actualtransactioncandlestickcharts, container, false); mChart = (CandleStickChart) view.findViewById(R.id.chart1); mChart.setBackgroundColor(Color.WHITE); mChart.setDescription(""); // if more than 60 entries are displayed in the chart, no values will be // drawn mChart.setMaxVisibleValueCount(60); // scaling can now only be done on x- and y-axis separately mChart.setPinchZoom(false); mChart.setDrawGridBackground(false); XAxis xAxis = mChart.getXAxis(); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setSpaceBetweenLabels(2); xAxis.setDrawGridLines(false); YAxis leftAxis = mChart.getAxisLeft(); // leftAxis.setEnabled(false); leftAxis.setLabelCount(7, false); leftAxis.setDrawGridLines(false); leftAxis.setDrawAxisLine(false); YAxis rightAxis = mChart.getAxisRight(); rightAxis.setEnabled(false); // rightAxis.setStartAtZero(false); mChart.getLegend().setEnabled(false); mChart.setNoDataText("?"); if (!isFull) { mChart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(getActivity(), ActualTransactionCandlestickChartsActivity.class); getActivity().startActivity(intent); } }); } loadInitData(); return view; }
From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.Safe.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Intent myIntent = new Intent(); myIntent.setClass(getActivity(), SafeProfileActivity.class); D_Peer peer = null;//from w w w. j ava 2s . c om ArrayList<D_Peer> p = Safe.getPeers(); try { if (position >= p.size()) return; peer = p.get(position); } catch (Exception e) { return; } // pass data to profile myIntent.putExtra(P_SAFE_WHO, data[position][0]); // myIntent.putExtra(P_SAFE_ID, position); myIntent.putExtra(P_SAFE_GIDH, peer.getGIDH()); myIntent.putExtra(P_SAFE_LID, peer.getLIDstr()); myIntent.putExtra(P_SAFE_PIMG, String.valueOf(R.drawable.placeholder)); startActivity(myIntent); }
From source file:com.dit599.customPD.editorUI.FloorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_tab, container, false); final MapEditActivity activity = (MapEditActivity) getActivity(); depth = Integer.valueOf(getTag()); Log.d("FloorFragment", "Depth is " + depth); activeLevelTemplate = activity.templateHandler.getLevel(depth); mobbut1 = (ImageButton) root.findViewById(R.id.mobsbutton1); mobbut2 = (ImageButton) root.findViewById(R.id.mobsbutton2); mobbut3 = (ImageButton) root.findViewById(R.id.mobsbutton3); mobbut4 = (ImageButton) root.findViewById(R.id.mobsbutton4); roomButton = (Button) root.findViewById(R.id.roomsbutton); this.mobbut1.setOnClickListener(new OnClickListener() { @Override// ww w . j a v a 2 s. c o m public void onClick(View v) { Intent intent = new Intent(); intent.setClass(activity, MapMobItemActivity.class); intent.putExtra("mobIndex", 0); intent.putExtra(MapEditActivity.EXTRA_FILENAME, activity.templateHandler.getDungeon().name); intent.putExtra(EnchantableItemsActivity.EXTRA_DEPTH, depth); startActivity(intent); } }); this.mobbut2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(activity, MapMobItemActivity.class); intent.putExtra("mobIndex", 1); intent.putExtra(MapEditActivity.EXTRA_FILENAME, activity.templateHandler.getDungeon().name); intent.putExtra(EnchantableItemsActivity.EXTRA_DEPTH, depth); startActivity(intent); } }); this.mobbut3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(activity, MapMobItemActivity.class); intent.putExtra("mobIndex", 2); intent.putExtra(MapEditActivity.EXTRA_FILENAME, activity.templateHandler.getDungeon().name); intent.putExtra(EnchantableItemsActivity.EXTRA_DEPTH, depth); startActivity(intent); } }); this.mobbut4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(activity, MapMobItemActivity.class); intent.putExtra("mobIndex", 3); intent.putExtra(MapEditActivity.EXTRA_FILENAME, activity.templateHandler.getDungeon().name); intent.putExtra(EnchantableItemsActivity.EXTRA_DEPTH, depth); startActivity(intent); } }); themeSpn = (Spinner) root.findViewById(R.id.theme_spinner); List<String> themeItems = LevelMapping.getAllNames(); themeAdapter = new ArrayAdapter<String>(root.getContext(), android.R.layout.simple_spinner_item, themeItems); themeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); themeSpn.setAdapter(themeAdapter); themeSpn.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (((String) themeSpn.getSelectedItem()).contains("Boss")) { mobbut1.setEnabled(false); mobbut2.setEnabled(false); mobbut3.setEnabled(false); mobbut4.setEnabled(false); roomButton.setEnabled(false); } else { mobbut1.setEnabled(true); mobbut2.setEnabled(true); mobbut3.setEnabled(true); mobbut4.setEnabled(true); roomButton.setEnabled(true); } activity.templateHandler.getLevel(depth).theme = LevelMapping .getThemeClass((String) themeSpn.getSelectedItem()); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mobFrequencySpn = (Spinner) root.findViewById(R.id.frequency_spinner); frequencyAdapter = new ArrayAdapter<String>(root.getContext(), android.R.layout.simple_spinner_item, FREQUENCIES); frequencyAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mobFrequencySpn.setAdapter(frequencyAdapter); mobFrequencySpn.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selected = (String) mobFrequencySpn.getSelectedItem(); if (selected.equals(FREQUENCIES[3])) { activeLevelTemplate.timeToRespawn = 15; } else if (selected.equals(FREQUENCIES[2])) { activeLevelTemplate.timeToRespawn = 30; } else if (selected.equals(FREQUENCIES[1])) { activeLevelTemplate.timeToRespawn = 50; } else { activeLevelTemplate.timeToRespawn = 80; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); mobLimitSpn = (Spinner) root.findViewById(R.id.mob_limit_spinner); mobLimitAdapter = new ArrayAdapter<String>(root.getContext(), android.R.layout.simple_spinner_item, MOB_LIMITS); mobLimitAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mobLimitSpn.setAdapter(mobLimitAdapter); mobLimitSpn.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int mobLimit = Integer.valueOf((String) mobLimitSpn.getSelectedItem()); activeLevelTemplate.maxMobs = mobLimit; } @Override public void onNothingSelected(AdapterView<?> parent) { } }); initItemCategoryButtons(root); // loadTemplateToUI(); return root; }
From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.MotionDetail.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Log.d("MotionDetail", "onOptionsItemSelected"); if (item.getItemId() == R.id.motion_detail_add_new_motion) { Toast.makeText(this, "add a new Motion", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(); intent.setClass(this, AddMotion.class); Bundle b = new Bundle(); b.putString(Motion.M_MOTION_LID, crt_motion.getLIDstr()); intent.putExtras(b);// w w w .j av a2 s . c o m startActivity(intent); } if (item.getItemId() == R.id.view_votes) { Intent intent = new Intent(); intent.setClass(this, ViewVotes.class); Bundle b = new Bundle(); b.putString(Motion.M_MOTION_LID, crt_motion.getLIDstr()); if (JustificationBySupportType.checkedJustifLID > 0) { b.putString(Motion.J_JUSTIFICATION_LID, Util.getStringID(JustificationBySupportType.checkedJustifLID)); } else { // put a nonull value to get only the votes with no // justification! } intent.putExtras(b); startActivity(intent); } if (item.getItemId() == R.id.motion_detail_export) { Log.d("MotionDetail", "onOptionsItemSelected: export"); DD_SK d_SK = new DD_SK(); Log.d("MotionDetail", "onOptionsItemSelected: add motion: " + crt_motion); DD_SK.addMotionToDSSK(d_SK, crt_motion); long checked_justificationLID = JustificationBySupportType.checkedJustifLID; if (checked_justificationLID > 0) { D_Justification checked_justification = D_Justification.getJustByLID(checked_justificationLID, false, false); if (checked_justification != null) DD_SK.addJustificationWithAnySupportToDSSK(d_SK, checked_justification, DD.getCrtConstituent(crt_motion.getOrganizationLID()), false); } /* DD_SK_Entry dsk = new DD_SK_Entry(); dsk.key = constituent.getSK(); dsk.name = constituent.getNameOrMy(); dsk.creation = constituent.getCreationDate(); dsk.type = "Motion Detail!"; d_SK.sk.add(dsk); */ Log.d("MotionDetail", "onOptionsItemSelected: export motion: " + d_SK); String testText = DD.getExportTextObjectBody(d_SK); String testSubject = DD.getExportTextObjectTitle(crt_motion); //"DDP2P: Motion Detail of \""+ crt_motion.getTitleStrOrMy() + "\" in \""+ crt_motion.getOrganization().getName()+"\" " + Safe.SAFE_TEXT_MY_HEADER_SEP; /* * if (organization_gidh == null) { Toast.makeText(this, * "No peer. Reload!", Toast.LENGTH_SHORT).show(); return true; } */ //DD_Address adr = new DD_Address(); Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT, testText); i.putExtra(Intent.EXTRA_SUBJECT, testSubject); i = Intent.createChooser(i, "send motion Public key"); startActivity(i); } return super.onOptionsItemSelected(item); }
From source file:com.cdhxqh.inventorymovement.ui.MainActivity.java
/** * ??*/*www .j a v a2s . com*/ */ private void setSearchButton(int mark) { if (mark == 0) { //? Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 1) { Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 2) { Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 3) { // Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 4) { //? Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 5) { //? searchButton.setVisibility(View.GONE); } else if (mark == 6) { Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } else if (mark == 7) { Intent intent = new Intent(); intent.putExtra("search_mark", mark); intent.setClass(MainActivity.this, SearchActivity.class); startActivityForResult(intent, 0); } }
From source file:com.battlelancer.seriesguide.ui.NowFragment.java
/** * Starts an activity to display the given episode. *///w w w .ja va 2 s. com protected void showDetails(View view, int episodeId) { Intent intent = new Intent(); intent.setClass(getActivity(), EpisodesActivity.class); intent.putExtra(EpisodesActivity.InitBundle.EPISODE_TVDBID, episodeId); ActivityCompat.startActivity(getActivity(), intent, ActivityOptionsCompat .makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight()).toBundle()); }
From source file:com.android.deskclock.timer.TimerReceiver.java
private void stopRingtoneIfNoTimesup(final Context context) { if (Timers.findExpiredTimer(mTimers) == null) { // Stop ringtone Log.d(TAG, "stopping ringtone"); Intent si = new Intent(); si.setClass(context, TimerRingService.class); context.stopService(si);/* w ww . ja v a 2s . co m*/ } }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionLivestreamActivity.java
/** * Helper method to start this activity using only extras (rather than session uri). * @param context The package context/* w ww . j av a2s .co m*/ * @param youtubeUrl The youtube url or video id to load * @param track The track title (appears as part of action bar title), can be null * @param title The title to show in the session info fragment, can be null * @param sessionAbstract The session abstract to show in the session info fragment, can be null */ public static void startFromExtras(Context context, String youtubeUrl, String track, String title, String sessionAbstract) { if (youtubeUrl == null) { return; } final Intent i = new Intent(); i.setClass(context, SessionLivestreamActivity.class); i.putExtra(EXTRA_YOUTUBE_URL, youtubeUrl); i.putExtra(EXTRA_TRACK, track); i.putExtra(EXTRA_TITLE, title); i.putExtra(EXTRA_ABSTRACT, sessionAbstract); context.startActivity(i); }
From source file:com.appdynamics.demo.gasp.activity.LocationsActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { /*// w w w . j av a 2 s .co m // (Re-)register with Gasp GCM Server case R.id.options_register: mGaspRegistrationClient.doRegisterGasp(this); return true; // Unregister with Gasp GCM Server case R.id.options_unregister: mGaspRegistrationClient.doUnregisterGasp(this); return true; case R.id.options_exit: finish(); return true; */ case R.id.gasp_settings: Intent intent = new Intent(); intent.setClass(LocationsActivity.this, SetPreferencesActivity.class); startActivityForResult(intent, 0); return true; case R.id.gasp_menu_twitter: intent = new Intent(); intent.setClass(LocationsActivity.this, TwitterStreamActivity.class); startActivityForResult(intent, 0); return true; case R.id.gasp_data: intent = new Intent(); intent.setClass(LocationsActivity.this, GaspDataActivity.class); startActivityForResult(intent, 0); return true; /* case R.id.gasp_reviews_data: intent = new Intent(); intent.setClass(LocationsActivity.this, ReviewListActivity.class); startActivityForResult(intent, 0); return true; case R.id.gasp_restaurants_data: intent = new Intent(); intent.setClass(LocationsActivity.this, RestaurantListActivity.class); startActivityForResult(intent, 0); return true; case R.id.gasp_users_data: intent = new Intent(); intent.setClass(LocationsActivity.this, UserListActivity.class); startActivityForResult(intent, 0); return true; */ case R.id.gasp_login_with_amazon: intent = new Intent(); intent.setClass(LocationsActivity.this, AmazonSignInActivity.class); startActivityForResult(intent, 0); return true; case R.id.gasp_login_with_google: intent = new Intent(); intent.setClass(LocationsActivity.this, GoogleSignInActivity.class); startActivityForResult(intent, 0); return true; default: return super.onOptionsItemSelected(item); } }