当前位置: 首页>>代码示例>>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;未经允许,请勿转载。