當前位置: 首頁>>代碼示例>>Java>>正文


Java FragmentActivity.startActivity方法代碼示例

本文整理匯總了Java中android.support.v4.app.FragmentActivity.startActivity方法的典型用法代碼示例。如果您正苦於以下問題:Java FragmentActivity.startActivity方法的具體用法?Java FragmentActivity.startActivity怎麽用?Java FragmentActivity.startActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v4.app.FragmentActivity的用法示例。


在下文中一共展示了FragmentActivity.startActivity方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showRedPacketDetail

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
/**
 * 顯示紅包詳情的方法
 *
 * @param redPacketInfo 紅包詳情數據
 * @param activity      FragmentActivity
 * @param callBack      RPOpenPacketCallback
 */
private void showRedPacketDetail(RedPacketInfo redPacketInfo, FragmentActivity activity, RPOpenPacketCallback callBack) {
    if (redPacketInfo.redPacketType.equals(RPConstant.RED_PACKET_TYPE_SINGLE_RANDOM)) {
        if (redPacketInfo.messageDirect.equals(RPConstant.MESSAGE_DIRECT_RECEIVE)) {
            if (redPacketInfo.status == RPConstant.RED_PACKET_STATUS_RECEIVABLE) {
                mRandomDetailCallback = new RandomDetailCallback(redPacketInfo, callBack, activity);
                mRandomDetailCallback.receiveRedPacket();
                return;
            }
        }
        callBack.hideLoading();
        if (mRandomDetailDialogFragment == null) {
            mRandomDetailDialogFragment = RandomDetailDialogFragment.newInstance(redPacketInfo);
        } else {
            //for bug:Fragment already active
            if (mRandomDetailDialogFragment.isAdded()) return;
            mRandomDetailDialogFragment.setArguments(redPacketInfo);
        }
        if (mRandomDetailDialogFragment != null && !mRandomDetailDialogFragment.isAdded()) {
            showAllowingStateLost(mRandomDetailDialogFragment, activity);
        }
    } else {
        callBack.hideLoading();
        Intent intent = new Intent(activity, RPDetailActivity.class);
        intent.putExtra(RPConstant.EXTRA_RED_PACKET_INFO, redPacketInfo);
        activity.startActivity(intent);
    }
}
 
開發者ID:YunzhanghuOpen,項目名稱:redpacketui-open,代碼行數:35,代碼來源:RPRedPacketUtil.java

示例2: handleMenuClick

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
public static boolean handleMenuClick(@NonNull FragmentActivity activity, @NonNull Song song, int menuItemId) {
    switch (menuItemId) {
        case R.id.action_set_as_ringtone:
            MusicUtil.setRingtone(activity, song.id);
            return true;
        case R.id.action_share:
            activity.startActivity(Intent.createChooser(MusicUtil.createShareSongFileIntent(song), null));
            return true;
        case R.id.action_delete_from_device:
            DeleteSongsDialog.create(song).show(activity.getSupportFragmentManager(), "DELETE_SONGS");
            return true;
        case R.id.action_add_to_playlist:
            AddToPlaylistDialog.create(song).show(activity.getSupportFragmentManager(), "ADD_PLAYLIST");
            return true;
        case R.id.action_play_next:
            MusicPlayerRemote.playNext(song);
            return true;
        case R.id.action_add_to_current_playing:
            MusicPlayerRemote.enqueue(song);
            return true;
        case R.id.action_tag_editor:
            Intent tagEditorIntent = new Intent(activity, SongTagEditorActivity.class);
            tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_ID, song.id);
            if (activity instanceof PaletteColorHolder)
                tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_PALETTE, ((PaletteColorHolder) activity).getPaletteColor());
            activity.startActivity(tagEditorIntent);
            return true;
        case R.id.action_details:
            SongDetailDialog.create(song).show(activity.getSupportFragmentManager(), "SONG_DETAILS");
            return true;
        case R.id.action_go_to_album:
            NavigationUtil.goToAlbum(activity, song.albumId);
            return true;
        case R.id.action_go_to_artist:
            NavigationUtil.goToArtist(activity, song.artistId);
            return true;
    }
    return false;
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:40,代碼來源:SongMenuHelper.java

示例3: handleMenuClick

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
public static boolean handleMenuClick(@NonNull FragmentActivity activity, @NonNull Song song, int menuItemId) {
    switch (menuItemId) {
        case R.id.action_set_as_ringtone:
            MusicUtil.setRingtone(activity, song.id);
            return true;
        case R.id.action_share:
            activity.startActivity(Intent.createChooser(MusicUtil.createShareSongFileIntent(song, activity), null));
            return true;
        case R.id.action_delete_from_device:
            DeleteSongsDialog.create(song).show(activity.getSupportFragmentManager(), "DELETE_SONGS");
            return true;
        case R.id.action_add_to_playlist:
            AddToPlaylistDialog.create(song).show(activity.getSupportFragmentManager(), "ADD_PLAYLIST");
            return true;
        case R.id.action_play_next:
            MusicPlayerRemote.playNext(song);
            return true;
        case R.id.action_add_to_current_playing:
            MusicPlayerRemote.enqueue(song);
            return true;
        case R.id.action_tag_editor:
            Intent tagEditorIntent = new Intent(activity, SongTagEditorActivity.class);
            tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_ID, song.id);
            if (activity instanceof PaletteColorHolder)
                tagEditorIntent.putExtra(AbsTagEditorActivity.EXTRA_PALETTE, ((PaletteColorHolder) activity).getPaletteColor());
            activity.startActivity(tagEditorIntent);
            return true;
        case R.id.action_details:
            SongDetailDialog.create(song).show(activity.getSupportFragmentManager(), "SONG_DETAILS");
            return true;
        case R.id.action_go_to_album:
            NavigationUtil.goToAlbum(activity, song.albumId);
            return true;
        case R.id.action_go_to_artist:
            NavigationUtil.goToArtist(activity, song.artistId);
            return true;
    }
    return false;
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:40,代碼來源:SongMenuHelper.java

示例4: start

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
public static void start(FragmentActivity fragmentActivity, Class<?> activityClass)
{
	fragmentActivity.startActivity(new Intent(fragmentActivity, activityClass), ActivityOptionsCompat.makeSceneTransitionAnimation(fragmentActivity).toBundle());
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:5,代碼來源:Preferences.java

示例5: openFile

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
public static void openFile(FragmentActivity activity, String filepath)
{
    
    File file = new File(filepath);
    if (file != null && file.exists() && file.isFile())
    {
        String fileName = file.toString();
        Intent intent = null;
        
        if (isPDFFile(filepath))
        {
            intent = MIP_OpenFilesUtils.getPdfFileIntent(file);
        }
        else
        {
            if (checkEndsWithInStringArray(fileName, fileEndingImage))
            {
                intent = MIP_OpenFilesUtils.getImageFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingWebText))
            {
                intent = MIP_OpenFilesUtils.getHtmlFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingPackage))
            {
                intent = MIP_OpenFilesUtils.getApkFileIntent(file);
                
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingAudio))
            {
                intent = MIP_OpenFilesUtils.getAudioFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingVideo))
            {
                intent = MIP_OpenFilesUtils.getVideoFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingText))
            {
                intent = MIP_OpenFilesUtils.getTextFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingPdf))
            {
                intent = MIP_OpenFilesUtils.getPdfFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingWord))
            {
                intent = MIP_OpenFilesUtils.getWordFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingExcel))
            {
                intent = MIP_OpenFilesUtils.getExcelFileIntent(file);
            }
            else if (checkEndsWithInStringArray(fileName, fileEndingPPT))
            {
                intent = MIP_OpenFilesUtils.getPPTFileIntent(file);
            }
            else
            {
                Toast.makeText(activity, "無法打開,請安裝相應的軟件!", Toast.LENGTH_SHORT).show();
            }
        }
        
        try
        {
            if (intent != null)
            {
                activity.startActivity(intent);
            }
        }
        catch (Exception e)
        {
            // TODO: handle exception
            Toast.makeText(activity, "無法打開,請安裝相應的軟件!", Toast.LENGTH_SHORT).show();
        }
    }
    else
    {
        Toast.makeText(activity, "無法打開該文件!", Toast.LENGTH_LONG).show();
    }
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:81,代碼來源:MIP_OpenFilesUtils.java

示例6: goToSettings

import android.support.v4.app.FragmentActivity; //導入方法依賴的package包/類
/**
 * Just a helper methods in case the user blocks permission.
 * It goes to your application settings page for the user to enable permission again.
 *
 * @param activity "this"
 */
public static void goToSettings(FragmentActivity activity) {
	activity.startActivity(new Intent(
			Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
			Uri.fromParts("package", activity.getPackageName(), null)));
}
 
開發者ID:sensorberg-dev,項目名稱:permission-bitte,代碼行數:12,代碼來源:PermissionBitte.java


注:本文中的android.support.v4.app.FragmentActivity.startActivity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。