Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 웹뷰
- jsp
- MSsql
- STS
- decompiler
- 컬럼명
- asp.net
- 자바
- Apache Lucene
- 웹 서비스
- scrollView
- Eclipse
- Web Service
- Android
- WebView
- TextBox
- varags
- MANTIS
- 자바스크립트
- MS-SQL
- javascript
- Maven
- SpringSource Tool Suite
- 안드로이드
- Bootstrap
- 이클립스
- Redirect
- html
- C#
- Java
Archives
- Today
- Total
bboks.net™
모든 액티비티 종료 시키기 본문
package com.hrupin; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; public abstract class AppBaseActivity extends Activity { public static final String FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION = "com.hrupin.FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION"; private BaseActivityReceiver baseActivityReceiver = new BaseActivityReceiver(); public static final IntentFilter INTENT_FILTER = createIntentFilter(); private static IntentFilter createIntentFilter() { IntentFilter filter = new IntentFilter(); filter.addAction(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION); return filter; } protected void registerBaseActivityReceiver() { registerReceiver(baseActivityReceiver, INTENT_FILTER); } protected void unRegisterBaseActivityReceiver() { unregisterReceiver(baseActivityReceiver); } public class BaseActivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION)) { finish(); } } } protected void closeAllActivities() { sendBroadcast(new Intent(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION)); } }
적용해야 하는 액티비티 구현시 AppBaseActivity를 상속하고
액티비티들을 종료하고 싶은때 sendBroadCast(FINISH_ALL_ACTIVITIES_ACTIVITY_ACTION) 메소드 호출
[출처] How to finish all activities in your Android application through simple call