InterviewSolution
Saved Bookmarks
| 1. |
Take a scenario where I have to design a screen in Frame Layout. In this frame layout, I have 4 child view for displaying buttons for other functionality. But when I am running it they are overlapping with each other.Can you suggest me a solution to resolve this problem? |
|
Answer» For doing some job like Application Update or where you want your CPU KEEPS running before the device go to sleep so we can use Power MANAGER service. This service will GIVE you ONE feature like WakeLock that allows our application to control the power state. if we need to want to keep the screen on in our activity, we need to use FLAG_KEEP_SCREEN_ON. As mention below: permission android:name="android.permission.WAKE_LOCK" />We will write below code in activity.java // Get an instance of the SensorManager mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); // Get an instance of the PowerManager mPowerManager = (PowerManager) getSystemService(POWER_SERVICE); // Get an instance of the WindowManager mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE); mWindowManager.getDefaultDisplay(); // Create a bright wake lock mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass() .getName()); |
|