Starting an Android activity as a dialog without using a theme modifier?

This doesn't really make since, because an activity is not a dialog. By setting the theme, all you are doing is causing the activity to visually use the theme of a dialog. It is still an activity, however, will all of the normal activity behavior.In other words, there is no Dialog object with its associated behavior.

Thanks a lot, it cleared up my confusion regarding activities started using dialog theme. – sazwqa Sep 27 '10 at 6:09.

I just wanted to reproduce this cancelOutside Dialog behavior on one of my Dialog style Activity. For this I extracted the Dialog source code (Dialog. Java) handling the touch event: public boolean onTouchEvent(MotionEvent event) { if (mCancelable && mCanceledOnTouchOutside && event.getAction() == MotionEvent.

ACTION_DOWN && isOutOfBounds(event)) { cancel(); return true; } return false; } private boolean isOutOfBounds(MotionEvent event) { final int x = (int) event.getX(); final int y = (int) event.getY(); final int slop = ViewConfiguration. Get(mContext). GetScaledWindowTouchSlop(); final View decorView = getWindow().getDecorView(); return (x (decorView.getWidth()+slop)) || (y > (decorView.getHeight()+slop)); } I Copy paste it in my Dialog style activity and changed small things: public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.

ACTION_DOWN && isOutOfBounds(event)) { finish(); return true; } return false; } private boolean isOutOfBounds(MotionEvent event) { final int x = (int) event.getX(); final int y = (int) event.getY(); final int slop = ViewConfiguration. Get(this). GetScaledWindowTouchSlop(); final View decorView = getWindow().getDecorView(); return (x (decorView.getWidth() + slop)) || (y > decorView.getHeight() + slop)); } It works fine!

Thank you,it save me much time – pengwang Oct 29 '10 at 0:11.

You can define your own style that extends Theme. Dialog in a values/styles. Xml file (or whatever you want to call it).

Check out developer.android.com/guide/topics/ui/th.... I'm not sure if this will work, but maybe try something like.

Unfortunately this won't work since mcanceledOnTouchOutside is private. Any ideas how android loads the activities when we apply Dialog/Transparent theme to it? It surely must be creating an instance of Dialog class and injecting the view into it after loading the activity.

If we can modify that behavior, it could work out. – sazwqa Sep 24 '10 at 0:15.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions