Post Reply 
Plus42 Equations, Preview Release
05-19-2022, 04:05 PM (This post was last modified: 05-19-2022 05:00 PM by johanw.)
Post: #692
RE: Plus42 Equations, Preview Release
(05-19-2022 01:41 PM)Thomas Okken Wrote:  Maybe calling finish() from an event handler is frowned upon, but why it would give different results in Free42 vs. Plus42, I have no clue...

How about this class (it is Java but the php tag was the only way I see how to format it a bit nicely):

PHP Code:
package org.thoughtcrime.securesms;

import android.content.Intent;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;

public class 
ExitActivity extends Activity {

  @
Override
  
protected void onCreate(Bundle savedInstanceState) {
    
super.onCreate(savedInstanceState);

    if (
Build.VERSION.SDK_INT >= 21) {
      
finishAndRemoveTask();
    } else {
      
finish();
    }

    
System.exit(0);
  }

  public static 
void exitAndRemoveFromRecentApps(Activity activity) {
    
Intent intent = new Intent(activityExitActivity.class);

    
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
            
Intent.FLAG_ACTIVITY_CLEAR_TASK
            
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
            
Intent.FLAG_ACTIVITY_NO_ANIMATION);

    
activity.startActivity(intent);
  }


You include the class and call ExitActivity.exitAndRemoveFromRecentApps(getActivity()); from your activity and include it in your manifest.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Plus42 Equations, Preview Release - johanw - 05-19-2022 04:05 PM



User(s) browsing this thread: 3 Guest(s)