Android: How can I programmatically draw text on key guard screen / lock screen?
By : user2416813
Date : March 29 2020, 07:55 AM
this will help Is there a way to draw on or modify the key guard wallpaper programmatically? , There is no API to draw on the lock screen.
|
320dp wide image taking up entire screen of Android emulator
By : user3297758
Date : March 29 2020, 07:55 AM
this will help dip means density-independent pixels. Your 480x800 emulator is most probably HDPI (high density, or high dots per inch), which means that 320dp will translate to 320*1.5 actual pixels (which is 480). Only on an MDPI (medium density) screen, where the scale factor is 1 will you actually get 320 pixels. You can get the scale factor for the current screen like this: code :
float scale = getResuorces().getDisplayMetrics().density;
android:layout_width="320px"
|
Android screen too wide?
By : Kemal
Date : March 29 2020, 07:55 AM
wish helps you I am trying to create a small web app for my android device, I am testing it and there is a scrollbar on my screen (horizontal) no matter what i set the body width, I get the scrollbar. I noticed m.facebook.com doesn't have it. Do I just simply hide the scrollbar? , Try : code :
webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
<uses-sdk android:minSdkVersion="4" /><supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"
/>
|
Turn off screen programmatically when face is close the screen on Android
By : Krishna M
Date : March 29 2020, 07:55 AM
Any of those help I found solution by disassembling one very famous VoIP application. This activity after pressing button1 will disable screen and hardware keys when you close sensors. After pressing button2 this function will be switched off. Also, this function required permission: code :
<uses-permission android:name="android.permission.WAKE_LOCK" />
public class MainActivity extends Activity {
private Button button1;
private Button button2;
private PowerManager powerManager;
private PowerManager.WakeLock wakeLock;
private int field = 0x00000020;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
// Yeah, this is hidden field.
field = PowerManager.class.getClass().getField("PROXIMITY_SCREEN_OFF_WAKE_LOCK").getInt(null);
} catch (Throwable ignored) {
}
powerManager = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(field, getLocalClassName());
setContentView(R.layout.main);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if(!wakeLock.isHeld()) {
wakeLock.acquire();
}
}
});
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if(wakeLock.isHeld()) {
wakeLock.release();
}
}
});
}
}
|
Make Android Screen Rotation configurable application wide
By : Kew Jie Long
Date : March 29 2020, 07:55 AM
this one helps. You need to set setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); inside onCreate() method in your activity. Or since that method is not always called you could put it in the onResume() method of your activity.
|