List of usage examples for android.content Intent setClass
public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls)
From source file:com.timemachine.controller.ControllerActivity.java
private void openSettings() { Intent intent = new Intent(); intent.setClass(ControllerActivity.this, SettingsActivity.class); startActivityForResult(intent, 0);/*from w ww. ja v a2 s .com*/ }
From source file:com.packetsender.android.MainActivity.java
public void updateSavedPacketsList(View rootView) { ListView packetListView = (ListView) rootView.findViewById(R.id.packetList); final Packet[] packetArray = dataStore.fetchAllSavedPackets(); PacketAdapter packetAdapter = new PacketAdapter(this, packetArray); if (packetListView != null) { packetListView.setAdapter(packetAdapter); packetAdapter.notifyDataSetChanged(); TextView noSavedPacketsText = (TextView) rootView.findViewById(R.id.noSavedPacketsText); if (packetAdapter.isEmpty()) { noSavedPacketsText.setVisibility(View.VISIBLE); } else {//from w w w. jav a2s . co m noSavedPacketsText.setVisibility(View.GONE); } packetListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { Log.d("main", DataStorage.FILE_LINE("Clicked " + position)); Packet sendPacket = packetArray[position].duplicate(); if (activeMenu == R.menu.acceptchangemenu) { Log.d("main", DataStorage.FILE_LINE("Need to delete " + sendPacket.name)); dataStore.DeleteSavedPacket(sendPacket); updateSavedPacketsList(packetsFragmentView); } else { Log.d("main", DataStorage .FILE_LINE("Need to send " + sendPacket.name + " data " + sendPacket.toAscii())); dataStore.sendPacketToService(sendPacket); } } }); packetListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Log.d("main", DataStorage.FILE_LINE("long click " + position)); Packet editPacket = packetArray[position].duplicate(); Intent newPacketActivity = DataStorage.getIntentFromPacket(editPacket); newPacketActivity.setClass(getApplicationContext(), NewPacketActivity.class); startActivity(newPacketActivity); return true; } }); } }
From source file:com.example.google.play.apkx.SampleDownloaderActivity.java
/** * This starts the movie by starting the video player activity with a * content URI for our custom APK extension content provider. *//*w w w . j av a2 s . co m*/ private void startMovie() { // launch the movie player activity Uri mediaUri = Uri.withAppendedPath(SampleZipFileProvider.ASSET_URI, "big_buck_bunny_720p_surround.m4v"); Intent intent = new Intent(); intent.setData(mediaUri); intent.putExtra(Intent.EXTRA_TITLE, mediaUri.getLastPathSegment()); intent.setClass(this, SampleVideoPlayerActivity.class); startActivity(intent); finish(); }
From source file:com.android.music.ArtistAlbumBrowserFragment.java
@Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { mCurrentAlbumId = Long.valueOf(id).toString(); Intent intent = new Intent(Intent.ACTION_PICK); intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); intent.setClass(getActivity(), TrackBrowserActivity.class); intent.putExtra("album", mCurrentAlbumId); Cursor c = (Cursor) mAdapter.getChild(groupPosition, childPosition); String album = c.getString(c.getColumnIndex(MediaStore.Audio.Albums.ALBUM)); if (album == null || album.equals(MediaStore.UNKNOWN_STRING)) { // unknown album, so we should include the artist ID to limit the songs to songs only by that artist mArtistCursor.moveToPosition(groupPosition); mCurrentArtistId = mArtistCursor.getString(mArtistCursor.getColumnIndex(MediaStore.Audio.Artists._ID)); intent.putExtra("artist", mCurrentArtistId); }/* w w w . ja v a 2s. co m*/ startActivity(intent); return true; }
From source file:com.miz.mizuu.fragments.TvShowDetailsFragment.java
private void searchCover() { Intent i = new Intent(); i.setClass(mContext, ShowCoverFanartBrowser.class); i.putExtra("id", thisShow.getId()); i.putExtra(IntentKeys.TOOLBAR_COLOR, mToolbarColor); startActivity(i);/*from w w w . jav a2 s . c o m*/ }
From source file:com.miz.mizuu.fragments.TvShowDetailsFragment.java
private void identifyShow() { ArrayList<String> files = new ArrayList<String>(); Cursor cursor = MizuuApplication.getTvShowEpisodeMappingsDbAdapter().getAllFilepaths(thisShow.getId()); while (cursor.moveToNext()) files.add(cursor.getString(cursor.getColumnIndex(DbAdapterTvShowEpisodeMappings.KEY_FILEPATH))); cursor.close();// w w w .j ava 2s .c o m Intent i = new Intent(); i.setClass(mContext, IdentifyTvShow.class); i.putExtra("showTitle", thisShow.getTitle()); i.putExtra("showId", thisShow.getId()); i.putExtra(IntentKeys.TOOLBAR_COLOR, mToolbarColor); startActivityForResult(i, 0); }
From source file:com.perm.DoomPlay.PlayingService.java
private Notification createNotification() { Intent intentActivity; if (SettingActivity.getPreferences(SettingActivity.keyOnClickNotif)) { intentActivity = new Intent(FullPlaybackActivity.actionReturnFull); intentActivity.setClass(this, FullPlaybackActivity.class); intentActivity.putExtra(FileSystemActivity.keyMusic, audios); } else {//from w ww .jav a2 s. com intentActivity = FullPlaybackActivity.getReturnSmallIntent(this, audios); } intentActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); Notification notification = new Notification(); notification.contentView = getNotifViews(R.layout.notif); notification.flags |= Notification.FLAG_FOREGROUND_SERVICE; notification.contentIntent = PendingIntent.getActivity(this, 0, intentActivity, PendingIntent.FLAG_UPDATE_CURRENT); notification.icon = isPlaying ? R.drawable.status_icon_pause : R.drawable.status_icon_play; return notification; }
From source file:com.perm.DoomPlay.PlayingService.java
private Notification createOldNotif() { NotificationCompat.Builder builder = new NotificationCompat.Builder(this); Intent intentActivity; if (SettingActivity.getPreferences(SettingActivity.keyOnClickNotif)) { intentActivity = new Intent(FullPlaybackActivity.actionReturnFull); intentActivity.setClass(this, FullPlaybackActivity.class); intentActivity.putExtra(FileSystemActivity.keyMusic, audios); } else {/*from w w w. j a va 2s .co m*/ intentActivity = FullPlaybackActivity.getReturnSmallIntent(this, audios); } intentActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); builder.setContentIntent( PendingIntent.getActivity(this, 0, intentActivity, PendingIntent.FLAG_UPDATE_CURRENT)) .setOngoing(true) .setSmallIcon(isPlaying ? R.drawable.status_icon_pause : R.drawable.status_icon_play); Audio audio = audios.get(indexCurrentTrack); builder.setContentTitle(audio.getTitle()); builder.setContentText(audio.getArtist()); Bitmap cover = AlbumArtGetter.getBitmapFromStore(audio.getAid(), this); if (cover == null) { Bitmap tempBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.fallback_cover); builder.setLargeIcon(tempBitmap); tempBitmap.recycle(); } else { builder.setLargeIcon(cover); cover.recycle(); } return builder.build(); }
From source file:org.openremote.android.console.GroupActivity.java
/** * Handle default menu("setting" and "logout"). * /* w ww.ja v a2 s. co m*/ * @param item the item */ public void handleMenu(MenuItem item) { switch (item.getItemId()) { case Constants.MENU_ITEM_SETTING: Intent intent = new Intent(); intent.setClass(GroupActivity.this, AppSettingsActivity.class); startActivity(intent); break; case Constants.MENU_ITEM_SSL: ViewHelper.showAlertViewWithTitle(GroupActivity.this, "Certificate information", ORKeyStore.getInstance(getApplicationContext()) .aliasInformation(AppSettingsModel.getCurrentServer(getApplicationContext()))); break; case Constants.MENU_ITEM_LOGOUT: doLogout(); break; } }
From source file:com.polyvi.xface.extension.camera.XCameraExt.java
/** * ?//from w w w .ja v a 2 s .c om * * ??????? * * @param uri */ private boolean startCutPhoto(Uri uri) { if (!(mTargetHeight > 0 && mTargetWidth > 0)) { XLog.e(CLASS_NAME, "Width and height must be larger than 1 when you want to crop image."); mCallbackCtx.error("you must give target width and height for crop photo."); return false; } // ???????? Uri cropped_image_uri = createEmptyFileForCroppedImageBeforeCrop(); Intent intent = new Intent(); intent.putExtra(ImageCroppingActivity.SOURCE_IMAGE_URI, uri); intent.putExtra(ImageCroppingActivity.CROPPED_IMAGE_URI, cropped_image_uri); intent.setClass(getContext(), ImageCroppingActivity.class); mExtensionContext.getSystemContext().startActivityForResult(this, intent, PICTURE_CUT_REQUEST_CODE); return true; }