【问题标题】:Android - Open File with another specific appAndroid - 使用另一个特定应用打开文件
【发布时间】:2014-10-17 14:52:48
【问题描述】:

我的应用程序下载 .zip、.js 和 .png,我想用另一个名为 Blocklauncher 的应用程序打开它们。 Blocklauncher 有一个特定的活动设置来打开这些文件。 .js 文件有一个意图过滤器设置,所以它们应该打开。但是 .zip 和 .png 文件并不那么容易。以下是 Blocklaunchers 清单中 .png 文件活动的样子

<activity android:name="net.zhuoweizhang.mcpelauncher.api.ImportSkinActivity">
            <intent-filter>
                <action android:name="net.zhuoweizhang.mcpelauncher.action.SET_SKIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/png" />
            </intent-filter>
        </activity>
        <activity-alias android:name="net.zhuoweizhang.mcpelauncher.ImportSkinActivity"     
android:exported="true" 
android:targetActivity="net.zhuoweizhang.mcpelauncher.api.ImportSkinActivity" />
        <activity android:name="net.zhuoweizhang.mcpelauncher.api.ImportTexturepackActivity">
            <intent-filter>
                <action android:name="net.zhuoweizhang.mcpelauncher.action.SET_TEXTUREPACK" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="*/*" />
            </intent-filter>
        </activity>

有人有什么想法吗?谢谢!

【问题讨论】:

    标签: android


    【解决方案1】:

    如果 BlockLauncher 用这个导入脚本:

    Intent intentMTex = new Intent("net.zhuoweizhang.mcpelauncher.action.IMPORT_SCRIPT");
    Uri texMPath = Uri.fromFile(new File(Environment.getExternalStorageDirectory().getPath() + "/Download/","Mech_Texture.zip"));
    intentMTex.setDataAndType(texMPath, "text/plain");
    

    你有没有尝试过改变

    intentMTex.setDataAndType(texMPath, "text/plain");
    

    Intent("net.zhuoweizhang.mcpelauncher.action.IMPORT_SCRIPT);
    

    intentMTex.setDataAndType(texMPath, "image/png");
    

    Intent("net.zhuoweizhang.mcpelauncher.action.SET_SKIN);
    

    ?

    请告诉我你做了 startActivity() :P

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-17
      • 1970-01-01
      相关资源
      最近更新 更多