本文整理汇总了Java中android.app.Activity.isFinishing方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.isFinishing方法的具体用法?Java Activity.isFinishing怎么用?Java Activity.isFinishing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.isFinishing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import android.app.Activity; //导入方法依赖的package包/类
public static void call(Activity activity, String messageId, OnClickListener yes, OnClickListener no) {
if (activity != null) {
Dialog dialog = new Builder(activity).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).setNegativeButton(R.string.dialog_default_no, no).create();
if (!activity.isFinishing() && !activity.isRestricted()) {
try {
dialog.show();
} catch (Exception e) {
}
}
}
}
示例2: showDialog
import android.app.Activity; //导入方法依赖的package包/类
public static void showDialog(Activity context, CharSequence title, CharSequence centerText, OnClickListener centerListener) {
if (mCommonDialog != null && mCommonDialog.isShowing()) {
mCommonDialog.dismiss();
}
mCommonDialog = new CommonDialog(context);
mCommonDialog.setTitle(title);
mCommonDialog.setButtonText(centerText);
if (centerListener != null) {
mCommonDialog.setCenterOnClickListener(centerListener);
}
if (!context.isFinishing() && !context.isRestricted()) {
try {
mCommonDialog.show();
} catch (Exception e) {
}
}
}
示例3: onActivityStopped
import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onActivityStopped(Activity activity) {
WebtrekkLogging.log("Tracking Activity stopped: " + getActivityName(activity) + " instance hash:" + activity.hashCode() + (activity.isFinishing() ? " as finishing" : " as sleeping"));
WebtrekkLogging.log("CurrentStatus before:"+mCurrentStatus+ " Current Activity:"+mCurrentActivityName + " Previous Activity:"+mPreviousActivitiesQueue.peek());
if (activity.isFinishing()) {
//activity is finishing increase activity counter and determine applicaiton shut down
mCurrentActivitiesCount--;
if (mCurrentActivitiesCount == 0 || (mFirstActivityName != null && mFirstActivityName.equals(getActivityName(activity))))
mCurrentStatus = STATUS.SHUT_DOWNING;
}else
{
// if this is not finishing activity and there is no any new activity started that is go to background process
String stoppedActivity = getActivityName(activity);
if (stoppedActivity.equals(mCurrentActivityName) && !activity.isChangingConfigurations() && (mCurrentActivityInstance == null || activity == mCurrentActivityInstance.get()))
{
mCurrentStatus = STATUS.GOING_TO_BACKGROUND;
mLastActivityVisibleTime = System.currentTimeMillis();
}
}
WebtrekkLogging.log("CurrentStatus after:"+mCurrentStatus + " Current Activity:"+mCurrentActivityName + " Previous Activity:"+mPreviousActivitiesQueue.peek());
}
示例4: finishAllActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 移除所有的activity(通常会在一键退出的时候使用)
*/
public void finishAllActivity(){
for (Activity activity : activityList){
if(!activity.isFinishing()){
activity.finish();
}
}
activityList.clear();
android.os.Process.killProcess(android.os.Process.myPid());
}
示例5: isSafe
import android.app.Activity; //导入方法依赖的package包/类
/**
* 检查activity是否安全
*/
public static boolean isSafe(Activity activity) {
if (activity == null || activity.isFinishing() || activity.isDestroyed()) {
return false;
}
return true;
}
示例6: finishActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 结束指定的Activity
*/
public void finishActivity(Activity activity) {
if (activity != null && !activity.isFinishing()) {
activityStack.remove(activity);
activity.finish();
activity = null;
}
}
示例7: call
import android.app.Activity; //导入方法依赖的package包/类
public static void call(Activity activity, int messageId, OnClickListener yes, OnClickListener no) {
if (activity != null) {
Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(messageId).setPositiveButton(2131100002, yes).setNegativeButton(2131100001, no).create();
if (!activity.isFinishing() && !activity.isRestricted()) {
try {
dialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
示例8: call
import android.app.Activity; //导入方法依赖的package包/类
public static void call(Activity activity, int title, int messageId, int yes, OnClickListener yesListener, boolean cancelable) {
if (activity != null) {
Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(messageId).setCancelable(cancelable).setPositiveButton(yes, yesListener).create();
if (!activity.isFinishing() && !activity.isRestricted()) {
dialog.show();
}
}
}
示例9: removeAll
import android.app.Activity; //导入方法依赖的package包/类
public void removeAll() {
if (!this.mActivityMap.isEmpty()) {
for (String key : this.mActivityMap.keySet()) {
Activity activity = (Activity) this.mActivityMap.get(key);
if (!(activity == null || activity.isFinishing())) {
activity.finish();
}
}
}
this.mActivityMap.clear();
}
示例10: finishAll
import android.app.Activity; //导入方法依赖的package包/类
public synchronized void finishAll() {
for (Activity a : createdActivities) {
if (!a.isFinishing()) {
a.finish();
}
}
createdActivities.clear();
}
示例11: obtain
import android.app.Activity; //导入方法依赖的package包/类
public static synchronized RemoteActivityManager obtain(Activity parent){
if(parent.isFinishing()){
throw new IllegalStateException("this activity has been finished : "+parent.toString());
}
if(sActivityManager.get(parent)==null){
RemoteActivityManager activityManager = new RemoteActivityManager(parent);
sActivityManager.put(parent,activityManager);
}
return sActivityManager.get(parent);
}
示例12: finishAll
import android.app.Activity; //导入方法依赖的package包/类
public static void finishAll()
{
for(Activity activity:activities)
{
if(!activity.isFinishing())
{
activity.finish();
}
}
}
示例13: finishActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 结束指定的Activity
*/
public void finishActivity(Activity activity) {
if (activity != null && !activity.isFinishing()) {
mActivityStack.remove(activity);
activity.finish();
}
}
示例14: update
import android.app.Activity; //导入方法依赖的package包/类
@Override
public void update(Observable observable, Object o) {
Activity activity = getActivity();
if (activity == null || activity.isFinishing()) {
return;
}
mChapters.clear();
if (o instanceof IChapterProvider) {
//noinspection unchecked
mChapters.addAll(((IChapterProvider)o).getChapters());
mRecyclerView.setAdapter(new NumberSelectionAdapter(mChapters.size(), CurrentSelected.getChapter() == null || CurrentSelected.getChapter().getId() == null ? null : Integer.parseInt(CurrentSelected.getChapter().getId()), this));
}
}
示例15: finishAll
import android.app.Activity; //导入方法依赖的package包/类
public static void finishAll(){
for(Activity activity:activities){
if(!activity.isFinishing())
activity.finish();
}
}