Activity of transparent background on the home screen of the last activity

I run Activity from the intent of android.intent.action.CALL. I would like to show a layout that looks like a dialog with progress with a transparent background (while I do the processing before transferring it to my native dialer). But behind the background that is visible, there should be a main screen.

At the moment, activity is loading normally, and the background outside the desired download dialog is transparent, but instead of the main screen, the last screen / application activity is displayed in the background.

How to make the background behind transparent to be the main screen?

+3
source share
5 answers

try runningMode = "singleInstance" in your manifest;)

0
source

, "Theme.Wallpaper"

i.e: <activity android:theme="@android:style/Theme.Wallpaper" />

, . , , :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="translucent_black">#CF000000</color>
</resources>
+8

( ) , . :

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.Context;
import android.util.Log;

public class Test {
public Test(Context c){
    ActivityManager am = (ActivityManager)c.getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningAppProcessInfo> list = am.getRunningAppProcesses();
    for (int i=0; i<list.size(); i++){
        Log.i("apps info", list.get(i).processName +"; PID=" + list.get(i).pid);
        if(list.get(i).importance == RunningAppProcessInfo.IMPORTANCE_VISIBLE){
            android.os.Process.killProcess(list.get(i).pid);
        }
    }
  }
}

, . .

0

, .

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    Drawable wallpaper = WallpaperManager.getInstance(this).getDrawable();
    // Set wallpaper to the background of the root view
}
0

-, , .

Secondly, receiving a broadcast will cause other applications to run in the foreground for a while (except for the main screen). Therefore, you just have to accept that it will be so.

You can either display the dialog box, or use the dialog theme so that the background activity, at the same time is a little shaded, or go the other way and just show the full activity.

0
source

All Articles