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 |
Tags
- javascript
- scrollView
- 안드로이드
- decompiler
- 자바스크립트
- Java
- 컬럼명
- STS
- C#
- varags
- MSsql
- Eclipse
- html
- Redirect
- Bootstrap
- jsp
- 자바
- Apache Lucene
- WebView
- Maven
- MS-SQL
- 웹 서비스
- MANTIS
- 웹뷰
- 이클립스
- Android
- Web Service
- SpringSource Tool Suite
- TextBox
- asp.net
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