代码如下:

Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(filePath)), type);
context.startActivity(intent);

异常信息提示如下:

03-20 16:46:48.760: E/AndroidRuntime(30325): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///storage/sdcard0/e-books/Books/book/课堂/PPT/第2章 移动终端.ppt typ=application/vnd.ms-powerpoint flg=0x10000000 }

经过:在有的手机,可以打开ppt文件,在我自己的手机打不开,调试后发现上面的错误信息。

原因:手机没有安装可以打开ppt文件的应用,会出现上面的问题。

解决方法:为了避免有的手机没有安装打开相应文件的应用,应该在startActivity那里做一个try catch,弹出一个toast做提示

ActivityNotFoundException: No Activity found to handle Intent的更多相关文章

  1. android.content.ActivityNotFoundException: No Activity found to handle Intent { (has extras) }

    报错: 初始代码: @OnClick(R.id.include_top_iv_more) public void onViewClicked() { Intent intent_chat_set = ...

  2. Android开发之bug-No Activity found to handle Intent

    android.content.ActivityNotFoundException: No Activity found to handle Intent 做Android开发中,使用隐式intent ...

  3. DownloadManager 版本更新,出现 No Activity found to handle Intent 的解决办法

    项目中,进行版本更新的时候,用的是自己写的下载方案,最近看到了使用系统服务 DownloadManager 进行版本更新,自己也试试. 在下载完成以后,安装更新的时候,出现了一个 crash,抓取的 ...

  4. Android:使用 DownloadManager 进行版本更新,出现 No Activity found to handle Intent 及解决办法

    项目中,进行版本更新的时候,用的是自己写的下载方案,最近看到了使用系统服务 DownloadManager 进行版本更新,自己也试试. 在下载完成以后,安装更新的时候,出现了一个 crash,抓取的 ...

  5. Activity启动模式 及 Intent Flags 与 栈 的关联分析

     http://blog.csdn.net/vipzjyno1/article/details/25463457    Android启动模式Flags栈Task   目录(?)[+] 什么是栈 栈 ...

  6. 【转】Activity启动模式 及 Intent Flags 与 栈 的关联分析

    http://blog.csdn.net/vipzjyno1/article/details/25463457    在学习Android的过程中,Intent是我们最常用Android用于进程内或进 ...

  7. Android学习之基础知识四-Activity活动3讲(Intent的使用)

    主活动名称FirstActivity.java改为了MenuTest.java 一.什么是Intent: 1.Intent是Android程序中各组件之间进行交互的重要方式,不仅可以指明当前组件想要进 ...

  8. 多个Activity相互调用和Intent

    MainActivity.java和OtherActivity.java的相互调用 首先MainActivity.java是Android程序自带的,新建一个类OtherActiviy extends ...

  9. 06 Activity的启动模式 Intent的七大属性的总结

    1.Task以及back stack     >Task(任务)  为了完成一个功能  多个Activity的集合,     当你的应用程序启动时 系统会自动创建Task用于管理Activity ...

随机推荐

  1. sql快捷键

    请柬:https://msdn.microsoft.com/zh-cn/library/ms174205.aspx

  2. SPRING IN ACTION 第4版笔记-第九章Securing web applications-003-把用户数据存在数据库

    一. 1.It’s quite common for user data to be stored in a relational database, accessed via JDBC . To c ...

  3. Qt: 多线程, 就是这么简单(确实非常简洁明了)

    #include <iostream>#include <QApplication>#include <QThread>#include <QString&g ...

  4. UVA548——Tree(中后序建树+DFS)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  5. POJ3278——Catch That Cow(BFS)

    Catch That Cow DescriptionFarmer John has been informed of the location of a fugitive cow and wants ...

  6. 常用PHP框架功能对比表

    自接触PHP开发以来,已使用了不少框架,虽然对每个框架都没有专研至深,但对每一款所使用的PHP框架功能都有一些了解的.至此,本人将大家常用的一些PHP框架功能整理成表,希望对大家在选择PHP框架时,可 ...

  7. 不只是技术!成为IT经理必备的十大软技能

    摘要:可能你是一名普通的IT从业员,一个小小的程序员,可随着社会的发展和科技的进步,对人才的要求越来越高,你可能通过技术获得了职位,但你若想升职加薪却少不了软技能:谈判技巧.积极倾听.演讲技巧以及领导 ...

  8. 安装和使用screen

    安装和使用screen 安装screenyum可以在线安装screenyum install screen 使用screen1.创建screen会话;进入Xshell,运行以下:screen 2.离开 ...

  9. mysqld -install命令时出现install/remove of the service denied错误的原因和解决办法

    原因:没有使用管理员权限 解决方法:使用管理员权限打开cmd,然后运行mysqld -install,服务安装成功

  10. Android-xUtils框架介绍(四)

    今天介绍xUtils的最后一个模块——HttpUtils,拖了那么久,终于要结束了.另外,码字不易,如果大家有什么疑问和见解,欢迎大家留言讨论.HttpUtils是解决日常工作过程中繁杂的上传下载文件 ...