android2018. 7. 16. 16:00

<activity android:name=".IntentActivity">

<intent-filter>

<action android:name="android.intent.action.VIEW" />

<action android:name="com.test.simpletest.SEARCH" />

</intent-filter>

</activity>



cli에서 테스트

am start -a com.test.simpletest.SEARCH -n com.test.simpletest/com.test.simpletest.IntentActivity


Other activity.



private Intent getCustomIntent(){
	final String START_INTENT = "com.test.simpletest.SEARCH";
	final String ACTIVITY_NAME = "com.test.simpletest.IntentActivity";
	final String HOME_PACKAGE_NAME = "com.test.simpletest";
	Intent intent = new Intent(START_INTENT);
	ComponentName name = new ComponentName(HOME_PACKAGE_NAME, ACTIVITY_NAME);
	intent.setComponent(name);
	//Same application에서는 아래의 Flag를 사용하지 않아야 호출 됩니다.
	/*intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
			| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);*/
	return intent;
}

'android' 카테고리의 다른 글

MediaPlayer  (0) 2018.07.18
Single Fragment 예제  (0) 2018.07.16
tutorialspoint  (0) 2018.07.16
custom view tutorial 따라하기 3  (0) 2018.07.16
custom view tutorial 따라하기 2  (0) 2018.07.13
Posted by easy16