android怎么用intent跳转到文件管理器

阿晔sir 2013-06-27 06:07:34
我想实现的是点击一个按钮,然后跳转到文件管理器的主界面,浏览文件。
Intent intent = new Intent();
intent.setAction("android.intent.action.MAIN");//这个地方换了很多都没达到效果
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);

里面的参数到底是哪个intent-filter的action名呢??
用android.intent.action.SEARCH可以跳到文件管理器的搜索界面
用com.mediatek.filemanager.DOWNLOAD_LOCATION可以跳到文件管理器的下载界面
用com.mediatek.filemanager.ADD_FILE可以跳到增加文件(粘贴)界面
所以的都试过了……
但是就不能到文件管理器的主界面!
求高手指点一二。
附上文件管理器的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mediatek.filemanager"
android:versionCode="1"
android:versionName="1.0" >

<application
android:hardwareAccelerated="true"
android:icon="@drawable/app_filemanager"
android:label="@string/app_name"
android:name=".FileManagerApplication">
<!-- Points to searchable activity so the whole app can invoke search. -->
<meta-data
android:name="android.app.default_searchable"
android:value="com.mediatek.filemanager.FileManagerSearchActivity" />

<activity
android:alwaysRetainTaskState="true"
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc"
android:label="@string/app_name"
android:launchMode="singleTask"
android:name="FileManagerOperationActivity"
android:theme="@style/FileManagerOperTheme"
android:uiOptions="splitActionBarWhenNarrow" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc"
android:label="@string/app_name"
android:launchMode="singleTask"
android:name=".FileManagerSearchActivity"
android:theme="@style/transparent">
<!-- FileManagerOperTheme -->
<intent-filter >
<action android:name="android.intent.action.SEARCH" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc"
android:label="@string/app_name"
android:name=".FileManagerSelectPathActivity"
android:theme="@android:style/Theme.Holo.Light.NoActionBar" >
<intent-filter >
<action android:name="com.mediatek.filemanager.DOWNLOAD_LOCATION" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc"
android:label="@string/app_name"
android:name=".FileManagerSelectFileActivity"
android:theme="@android:style/Theme.Holo.Light.NoActionBar" >
<intent-filter >
<action android:name="com.mediatek.filemanager.ADD_FILE" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
</activity>

<service android:name=".service.FileManagerService" >
<intent-filter >
<action android:name="com.mediatek.filemanager.service.FileManagerService" />
</intent-filter>
</service>
</application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="14" />

</manifest>
...全文
3222 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_29990773 2015-07-21
  • 打赏
  • 举报
回复
求告知com.mediatek.filemanager,com.mediatek.filemanager.FileManagerOperationActivity是Android自带的还是自己写的呢?我自己在AndroidManifest.xml里面配置了这两个之后还是报错
  • 打赏
  • 举报
回复
请问你这个问题解决了吗?我也遇到这个问题了真是百思不得其解,麻烦帮帮忙
碧青色 2013-11-20
  • 打赏
  • 举报
回复
我新建的一个android项目里面加一个button,点击进去提示错误,找不到相关类 E/AndroidRuntime(1756): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mediatek.filemanager/com.mediatek.filemanager.FileManagerOperationActivity}; have you declared this activity in your AndroidManifest.xml?
我用我心仰望 2013-09-22
  • 打赏
  • 举报
回复
到底能不能实现?如果可以的话给我具体讲讲呗
阿晔sir 2013-06-28
  • 打赏
  • 举报
回复
引用 3 楼 bboyliaoye 的回复:
[quote=引用 2 楼 guoyoulei520 的回复:] 这样呢
            Intent mIntent = new Intent( ); 
            ComponentName comp = new ComponentName("com.mediatek.filemanager", "com.mediatek.filemanager.FileManagerOperationActivity");
            mIntent.setComponent(comp); 
            mIntent.setAction("android.intent.action.VIEW"); 
            startActivity(mIntent);
可能需要设置mIntent.flag 为new_task,你试试吧
好的,我试试。先谢过了[/quote]还是弹框退出……我看下为什么会弹框吧
阿晔sir 2013-06-28
  • 打赏
  • 举报
回复
引用 3 楼 bboyliaoye 的回复:
[quote=引用 2 楼 guoyoulei520 的回复:] 这样呢
            Intent mIntent = new Intent( ); 
            ComponentName comp = new ComponentName("com.mediatek.filemanager", "com.mediatek.filemanager.FileManagerOperationActivity");
            mIntent.setComponent(comp); 
            mIntent.setAction("android.intent.action.VIEW"); 
            startActivity(mIntent);
可能需要设置mIntent.flag 为new_task,你试试吧
好的,我试试。先谢过了[/quote] 你好,用你给的代码试过了,能够跳转到文件管理器,但是伴随着我这个应用的弹框终止(sorry XXX has stopped),你说的mlntent.flag还没设置,我再设置看看。
阿晔sir 2013-06-28
  • 打赏
  • 举报
回复
引用 2 楼 guoyoulei520 的回复:
这样呢
            Intent mIntent = new Intent( ); 
            ComponentName comp = new ComponentName("com.mediatek.filemanager", "com.mediatek.filemanager.FileManagerOperationActivity");
            mIntent.setComponent(comp); 
            mIntent.setAction("android.intent.action.VIEW"); 
            startActivity(mIntent);
可能需要设置mIntent.flag 为new_task,你试试吧
好的,我试试。先谢过了
凉凉二点凉 2013-06-27
  • 打赏
  • 举报
回复
这样呢
            Intent mIntent = new Intent( ); 
            ComponentName comp = new ComponentName("com.mediatek.filemanager", "com.mediatek.filemanager.FileManagerOperationActivity");
            mIntent.setComponent(comp); 
            mIntent.setAction("android.intent.action.VIEW"); 
            startActivity(mIntent);
可能需要设置mIntent.flag 为new_task,你试试吧
阿晔sir 2013-06-27
  • 打赏
  • 举报
回复
自己顶下…………

80,359

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧