English 中文(简体)
如果在档案名称的其他地方存在一段时期,则与档案延期相匹配的路由不会奏效?
原标题:pathPattern to match file extension does not work if a period exists elsewhere in the file name?
  • 时间:2010-08-03 19:28:18
  •  标签:
  • android

我看到了许多例子,说明如何利用Pattern来确定特定档案延伸/类型的意图过滤器;例如,pathPattern=>*/xyz”

不幸的是,如果有关档案在其他地方有一段时期,例如“米.档案名称.xyz”,这似乎并不适当。

是否有一条与“我的档案名称.xyz”和“my.filename.xyz”相匹配的道路。

最佳回答

roid小组选择了一种不幸的方式来实施病房。 你们可以研究如何在roid湖实施配对模式。 模式材料类别:

https://github.com/android/platform_framework_base/blob/master/分/java/android/os/PatternMatcher.java

我们经常使用* 。 在PatterMatch的执行中,这种配对不满意。 页: 1

例:

String: "/mnt/my.file.mytype"
pathPattern: ".*\.mytype"

胎体中的“.*”与“胎面/胎面”相匹配,因此无法与胎体相匹配。

鉴于这一限制,我看不出一种办法,来写上一条能够与任何以“米型”为目的的扼杀相匹配的传道。 你可以做的最好办法是在Jason的解决方案之后增加更多的模式,使道路与你们愿意确定模式的许多方面相吻合。

问题回答

Ran into the same problemtries to open a file in a dot rafter. 我发现,我只能增加多个“数据”内容,这取决于我期望在我的道路上有多少点:

<data android:pathPattern=".*\.mytype"/>
<data android:pathPattern=".*\..*\.mytype"/>
<data android:pathPattern=".*\..*\..*\.mytype"/>
<data android:pathPattern=".*\..*\..*\..*\.mytype"/>

但幸运的是。 任何人都知道更好的方式?

我使用了这一方法:

<activity
   android:name=".activity.GifActivity"
   android:label="Cool Player ^_^">
   <intent-filter>
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:scheme="http"/>
       <data android:scheme="https" />
       <data android:host="*"/>
       <data android:pathPattern="/.*\.mp4"/>
   </intent-filter>
</activity>

这将在以下时间开放:

以下人士将不发言:

我认为这里的关键是<代码>host=”*。 我没有就此进行过彻底的研究。 但是,它为我工作,希望它也帮助人们走出那里。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签