이 활동 내에서 정규식을 실행하여
<activity
android:name=".WebActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.storyofmathematics.com"
android:scheme="http" />
<data
android:host="storyofmathematics.com"
android:scheme="http" />
</intent-filter>
</activity>
그런 다음 적절한 텐트 필터와 매니페스트에 활동을 추가하여 달성 할 수
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class WebActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent.getDataString().matches(
"http:\\/\\/((www.)?)storyofmathematics.com\\/.*story.html")) {
// is match - do stuff
} else {
// is not match - do other stuff
}
}
}
String/Link를 가져 와서 "특정 문자열"과 일치하는지 확인하거나 [patterns] (http://developer.android.com/reference/java/util)을 사용하여 원하는대로 검사하면됩니다. /regex/Pattern.html) – hrskrs
의도 필터 내에서 그렇게 할 수 있습니까? 앱과의 링크를 시작하는 옵션은 일치하는 경우에만 나타납니다. 예 : –
RobertEves92
끈을 가져 가야하는 모든 것의 전나무. 그것을 파싱하거나,'patters (regex)'를 사용하여 원하는대로 필터하거나 나누십시오. 그것이 당신의 필요와 일치하는지 확인한 다음 원하는대로하십시오. – hrskrs