Can i add a view to the top activity in broadcast receiver.
ActivityManager am = (ActivityManager) mContext
.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
componentInfo.getClassName() re开发者_运维知识库turns the class name of the top activity running. I can also get the package name. Can I add a view or some animation on current top activity. I need the layout name in most cases to bind to it but I am not able to figure out how to do it.
You can't do that, it would be quite a security concern if you do. However you may be able to start a new activity that's on top of it and doesn't cover the entire screen? What are you ultimately trying to accomplish?
Ok . i figured out . I started a service in the background , and then i got hold of the WindowManager and then inflated the view to be added . Then i used windowmanager.addView(inflatedView) .
精彩评论