The code I use is the following and it works for me:

Window mainWindow = getWindow();

//Set Blur
mainWindow.addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

//Set Dim
int dimAmt = 50; //In my application this is actually a setting stored in
preferences...
mainWindow.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
WindowManager.LayoutParams params = m_mainWindow.getAttributes();
params.dimAmount = dimAmt / 100f;
m_mainWindow.setAttributes(params);

As for the dim amount... you are setting it to 0 which tells it not to dim.
Also, I noticed that you are using setFlags while I use addFlags.  Try using
addFlags and see what happens...

Hope that helps,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Sun, Jul 25, 2010 at 9:00 AM, CyanBlue <cyanb...@gmail.com> wrote:

> Hi...  :)
>
> I am trying to start an activity and have that activity blur/dim over
> the current activity just like you do the same with the dialog
> widget... and I have tried reasonably all I can find on the web and I
> am not able to get it working...  :(
>
> On ActivityMain.java, I am using this code to start a new activity on
> button click...
>
> public void onClick(View v)
> {
>        Intent intent = new Intent(ActivityMain.this,
> com.cyanblue.activitytest.ActivitySub.class);
>        startActivityForResult(intent, 0);
> }
>
> In onCreate of the ActivitySub, I have tried these two examples which
> does not work at all...
>
>        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
> WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
>
>        WindowManager.LayoutParams lp = getWindow().getAttributes();
>        lp.dimAmount = 0.0f;
>        getWindow().setAttributes(lp);
>        getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
>
> and I am about to give up after trying this for 4 nights after
> work...  and I feel like it is not supposed to work or something...
>
> Does anybody know what I am doing wrong???
>
> I feel like startActivityForResult closes the current activity and run
> new activity till it gets the result back not like the dialog which
> runs on top of the current activity...  Is there any way to do this on
> multiple acitivities???
>
> Thank you...  :)
>
> CyanBlue
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to