0

I want to make a blurry transparent service application that make everything behind my application looks blurry, the problem is, I need to take a screenshot of entire device screen that is almost impossible

is there a trick to make my background looks blurry? or maybe is there any trick to make a view with some alpha that can make everything behind the view looks blurry?


EDITED:
Sorry for late response, to be honest, this answer is not what I needed but still thanks for your response, what I need is like this:

For example, I have 2 layer of layout:
layer A , this layer is the background
layer B , this layer is my application layer

My application is transparent, for example, if you open Settings, and then you open my apps, then my apps will popup and Settings still appear and the Settings view still can be seen, but I want that "Settings" view to be blurry.

So in general, I need to take a screenshot of my current Settings view, and then blur it using FastBlur, RenderScript or whatever it is, the problem is when I screenshot the Settings, it took a long time. so:

Is there any trick that I will cover the Settings view, that is Settings view is layer A, with layer B. and what I need to do with layer B to make everything behind layer B to be blur, any idea?

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
Alnov Lucky
  • 35
  • 1
  • 9
  • still need an answer :( – Alnov Lucky Jun 17 '16 at 03:15
  • You can make a custom toast and set its xml layout to be semi-transparent, i.e. with some alpha. This can make some effect on your view, but as far as I know, can't blur. – statosdotcom Jun 29 '16 at 05:57
  • yea it can be alpha, but i need a layout or something else that can blur all the thing behind it, thanks for your response btw!! – Alnov Lucky Jun 29 '16 at 09:09
  • this [tutorial](http://nicolaspomepuy.fr/blur-effect-for-android-design/) might help you – Bill Jul 15 '16 at 02:56
  • already see it before, it still need to capture the current view, what i need is to make a layout that make everything behind it blurred , thanks btw for your response – Alnov Lucky Jul 15 '16 at 03:38

1 Answers1

0

Create statoast.xml on your Layout folder:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toast_layout_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:textSize="30sp"
    android:textStyle="bold"
    android:gravity="center_horizontal"
    android:textColor="#ffffff"
    android:padding="20dp"
    android:background="@color/color_statoastBG"
    android:layout_gravity="center_horizontal" />
</LinearLayout>

Then insert this line inside <resources></resources> of your colors.xml file which is located on your Values folder (here you define the color and the alpha values - alpha are the two firsts values after "#"):

    <color name="color_statoastBG">#ccffcc00</color>

Then inflate your toast from your Java by calling this function:

public void staToast() {
    LayoutInflater inflater = getLayoutInflater();
    View layout = inflater.inflate(R.layout.statoast, (ViewGroup) findViewById(R.id.toast_layout_root));
    TextView text = (TextView) layout.findViewById(R.id.text);
    text.setText("This is a custom toast\n\nYou can use an ImageView here too");
    Toast toast = new Toast(getApplicationContext());
    toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.setView(layout);
    toast.show();
}

And, of course, you'll have to provide the necessary code to take a picture of device actual image and then put it on above this custom toast to get the effect you want. But... do not know how or if you will get margins and borders using all this. Please return with your thoughts and forgive any mistake/inconsistency. Best wishes.

statosdotcom
  • 3,109
  • 2
  • 17
  • 40
  • yeah, i forgot to tell, i already found how to make the image blurry, the problem is, how to take a screenshot of my entire device, i tried to take a screenshot using https://developer.android.com/reference/android/media/projection/MediaProjection.html but it takes a long time to take a screenshot and then put the screenshot into background of my view, so its like my application already launched, but it takes arround 1-2 secs delay to set a background to my view and also i tried the "SurfaceControl.screenshot" , but it returns null, any idea how to take a screenshot faster ? – Alnov Lucky Jun 30 '16 at 02:27
  • sorry for late response, please look at my note below ---EDITED--- , thanks :D – Alnov Lucky Jul 15 '16 at 02:35