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