List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.dlam.activity.T1Activity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //??activitycontext?context = getParent(); //????activitycontext???? //Context context = this.getParent(); requestWindowFeature(Window.FEATURE_NO_TITLE); mPullListView = new PullToRefreshListView(this); setContentView(mPullListView);//from ww w . j av a2s. c o m mPullListView.setPullLoadEnabled(true); mPullListView.setScrollLoadEnabled(true); time = formatDateTime(System.currentTimeMillis()); getListgetInfoList(Integer.toString(curPage), "0", "0", time, new VolleyDataCallback() { @Override public void onSuccess(A_ListBean bean) { curPage++; toaPage = Integer.parseInt(bean.getTotalpage()); datas = bean.getInfolist(); mAdapter = new A_ListDataAdapter(T1Activity.this, datas, R.layout.listitem); mListView = mPullListView.getRefreshableView(); mListView.setAdapter(mAdapter); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { myid = datas.get(position).getId().toString(); Intent intent = new Intent(); switch (datas.get(position).getType1id()) { case "1": intent.putExtra("myid", myid); intent.setClass(T1Activity.this, A_NewsDetailActivity.class); T1Activity.this.startActivity(intent); break; case "2": intent.putExtra("myid", myid); intent.setClass(T1Activity.this, A_ActivityDetailActivity.class); T1Activity.this.startActivity(intent); break; case "3": intent.putExtra("myid", myid); intent.setClass(T1Activity.this, A_ServiceDetailActivity.class); T1Activity.this.startActivity(intent); break; default: break; } } }); } }); mPullListView.setOnRefreshListener(new OnRefreshListener<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { //mIsStart = true; getUpdateData(); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { //mIsStart = false; getMoreData(); } }); setLastUpdateTime(); // mPullListView.doPullRefreshing(true, 5); }
From source file:com.android.managedprovisioning.DeviceOwnerProvisioningService.java
private void sendProgressUpdateToActivity() { Intent intent = new Intent(ACTION_PROGRESS_UPDATE); intent.putExtra(EXTRA_PROGRESS_MESSAGE_ID_KEY, mLastProgressMessage); intent.setClass(this, DeviceOwnerProvisioningActivity.ServiceMessageReceiver.class); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); }
From source file:com.embeddedlog.LightUpDroid.timer.TimerReceiver.java
private void updateNextTimesup(Context context) { TimerObj t = getNextRunningTimer(mTimers, false, Utils.getTimeNow()); long nextTimesup = (t == null) ? -1 : t.getTimesupTime(); int timerId = (t == null) ? -1 : t.mTimerId; Intent intent = new Intent(); intent.setAction(Timers.TIMES_UP);/* w w w . ja v a 2 s .co m*/ intent.setClass(context, TimerReceiver.class); if (!mTimers.isEmpty()) { intent.putExtra(Timers.TIMER_INTENT_EXTRA, timerId); } AlarmManager mngr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent p = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT); if (t != null) { if (Utils.isKitKatOrLater()) { mngr.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p); } else { mngr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p); } if (Timers.LOGGING) { Log.d(TAG, "Setting times up to " + nextTimesup); } } else { mngr.cancel(p); if (Timers.LOGGING) { Log.v(TAG, "no next times up"); } } }
From source file:com.petrodevelopment.dice.external.Router.java
private Intent intentFor(Context context, RouterParams params) { RouterOptions options = params.routerOptions; if (options.getCallback() != null) { return null; }//from ww w. ja va 2s . c om Intent intent = intentFor(params); intent.setClass(context, options.getOpenClass()); this.addFlagsToIntent(intent, context); return intent; }
From source file:com.sinelead.car.club.NewsFragment.java
private void initListView() { // set drop down listener listView.setOnDropDownListener(new OnDropDownListener() { @Override/*from ww w . j a v a 2 s. c om*/ public void onDropDown() { new GetDataTask(true).execute(); } }); // set on bottom listener listView.setOnBottomListener(new OnClickListener() { @Override public void onClick(View v) { new GetDataTask(false).execute(); } }); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ToastUtils.show(context, R.string.drop_down_tip); String newsUrl = articleAdapter.getArticleUrl((int) id); // activity,url Intent intent = new Intent(); intent.putExtra("url", newsUrl); /* intent */ intent.setClass(context, XinchepingActivity.class); /* Activity */ context.startActivity(intent); } }); // listView.setShowFooterWhenNoMore(true); articleAdapter = new NewsListAdapter(context, R.layout.listview_item_card); listView.setAdapter(articleAdapter); // listView.setSelector(new ColorDrawable(Color.LTGRAY)); }
From source file:com.grepsound.activities.MainActivity.java
@Override public void logOut() { SharedPreferences.Editor editor = getSharedPreferences("sc-token", Context.MODE_PRIVATE).edit(); editor.remove("token_access"); editor.remove("token_scopes"); editor.remove("token_refresh"); editor.apply();//from w w w . j a va 2 s .c o m Intent intent = new Intent(); intent.setClass(this, LoginActivity.class); sendBroadcast(new Intent(AudioService.commands.SHUTDOWN)); startActivity(intent); finish(); }
From source file:com.sinelead.car.club.NewsFragment.java
private void initImages() { viewPager = (AutoScrollViewPager) bannerView.findViewById(R.id.view_pager); // /*from w w w.j a v a 2s . co m*/ DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); viewPager.setLayoutParams(new LayoutParams(dm.widthPixels, (int) (dm.widthPixels / 1.68))); bannerText = (TextView) bannerView.findViewById(R.id.text_banner); imagePagerAdapter = new ImagePagerAdapter(context, bannerList).setInfiniteLoop(false); viewPager.setAdapter(imagePagerAdapter); viewPager.setInterval(6000); // 6 viewPager.startAutoScroll(); viewPager.setCurrentItem(0); // viewPager.setSlideBorderMode(AutoScrollViewPager.SLIDE_BORDER_MODE_TO_PARENT); indicator = (CirclePageIndicator) bannerView.findViewById(R.id.indicator); indicator.setViewPager(viewPager); indicator.setOnPageChangeListener(new ImageOnPageChangeListener()); viewPager.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ToastUtils.show(context, R.string.drop_down_tip); // activity,url Intent intent = new Intent(); intent.putExtra("url", currentImageUrl); /* intent */ intent.setClass(context, XinchepingActivity.class); /* Activity */ context.startActivity(intent); } }); }
From source file:com.aknowledge.v1.automation.RemoteActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { Intent intent = new Intent(); intent.setClass(RemoteActivity.this, SettingsActivity.class); startActivityForResult(intent, 0); return true; }// ww w . j a va2s.c o m if (id == R.id.Status) { readHostCredentials(); if (handler != null) { handler.removeCallbacksAndMessages(null); } getDevices(); startProgressBar(); } return super.onOptionsItemSelected(item); }
From source file:com.android.calendar.SearchActivity.java
private void showEventInfo(EventInfo event) { if (mShowEventDetailsWithAgenda) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); mEventInfoFragment = new EventInfoFragment(this, event.id, event.startTime.toMillis(false), event.endTime.toMillis(false), event.getResponse(), false, EventInfoFragment.DIALOG_WINDOW_STYLE, null /* No reminders to explicitly pass in. */); ft.replace(R.id.agenda_event_info, mEventInfoFragment); ft.commit();// w ww . jav a 2 s . c o m } else { Intent intent = new Intent(Intent.ACTION_VIEW); Uri eventUri = ContentUris.withAppendedId(Events.CONTENT_URI, event.id); intent.setData(eventUri); intent.setClass(this, EventInfoActivity.class); intent.putExtra(EXTRA_EVENT_BEGIN_TIME, event.startTime != null ? event.startTime.toMillis(true) : -1); intent.putExtra(EXTRA_EVENT_END_TIME, event.endTime != null ? event.endTime.toMillis(true) : -1); startActivity(intent); } mCurrentEventId = event.id; }
From source file:com.cellbots.eyes.EyesActivity.java
/** Called when the activity is first created. */ @Override// w w w . j a va2 s . c o m public void onCreate(Bundle savedInstanceState) { Log.e("remote eyes", "started"); super.onCreate(savedInstanceState); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock( PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE | PowerManager.ACQUIRE_CAUSES_WAKEUP, "Cellbot Eyes"); mWakeLock.acquire(); mTorchMode = false; out = new ByteArrayOutputStream(); if ((getIntent() != null) && (getIntent().getData() != null)) { putUrl = getIntent().getData().toString(); server = putUrl.replace("http://", ""); server = server.substring(0, server.indexOf("/")); Bundle extras = getIntent().getExtras(); if ((extras != null) && (extras.getBoolean("TORCH", false))) { mTorchMode = true; } } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); putUrl = prefs.getString("REMOTE_EYES_PUT_URL", ""); Log.e("prefs", putUrl); if (putUrl.length() < 1) { Intent i = new Intent(); i.setClass(this, PrefsActivity.class); startActivity(i); finish(); return; } else { server = putUrl.replace("http://", ""); server = server.substring(0, server.indexOf("/")); } } resetConnection(); mHttpState = new HttpState(); setContentView(R.layout.eyes_main); mPreview = (SurfaceView) findViewById(R.id.eyes_preview); mHolder = mPreview.getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mPreview.setOnClickListener(new OnClickListener() { public void onClick(View v) { setTorchMode(!mTorchMode); } }); mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { boolean useTorch = intent.getBooleanExtra("TORCH", false); boolean shouldTakePicture = intent.getBooleanExtra("PICTURE", false); setTorchMode(useTorch); setTakePicture(shouldTakePicture); } }; this.registerReceiver(mReceiver, new IntentFilter(EyesActivity.EYES_COMMAND)); mFrame = (FrameLayout) findViewById(R.id.eyes_frame); mWebView = new WebView(this); mWebView.getSettings().setJavaScriptEnabled(true); // Use this if you want to load content locally // mWebView.loadUrl("content://com.cellbot.localpersonas/default/index.html"); mWebView.loadUrl("http://personabots.appspot.com/expressions/tuby"); mFrame.addView(mWebView); }