Activity getWindowManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Activity getWindowManager method.

This code example shows how to use the following methods:getWindow, getWindowManager, getDefaultSharedPreferences
        super.onCreate(savedInstanceState);
    } 
 
    public static void setBackgroundImage (Activity activity)
    { 
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
        //int themeId = settings.getInt("theme", R.style.Theme_Gibberbot_Light); 
        boolean themeDark = settings.getBoolean("themeDark", false);
        String themebg = settings.getString("pref_background", "");
         
         
        if (themebg != null && themebg.length() > 0)
        { 
 
            File fileThemeBg = new File(themebg);
            if (!fileThemeBg.exists())
                return; 
             
            if (mThemeBg == null || (!mThemeBg.equals(themebg)))
            { 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager
        // do nothing 
    } 
 
    @Override 
    public int getRotationOffset(Activity activity) {
        final Display display = activity.getWindowManager().getDefaultDisplay();
 
        // the non deprecated method is available in API 8+ only, so we cannot deal better with this 
        @SuppressWarnings("deprecation") 
        final int rotation = display.getOrientation();
 
        if (rotation == Configuration.ORIENTATION_LANDSCAPE) {
            return 90; 
        } 
        return 0; 
    } 
 
    @Override 
    public File getExternalPictureDir() {
        // Use externalStorage/Pictures as default 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSystemService, getWindowManager
	private float[] geoMag = new float[3];
	private boolean rotateOrientation;
	private Display display;
 
	public AccelerometerListener(Activity activity) {
		sensorManager = (SensorManager) activity.getSystemService(Activity.SENSOR_SERVICE);
		accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
		display = activity.getWindowManager().getDefaultDisplay();
		updateOrientationInfo(); 
	} 
	 
	private void updateOrientationInfo() { 
		rotateOrientation = (display.getOrientation() == Surface.ROTATION_90) ? true : false;
	} 
 
	public float getX() { 
		return (rotateOrientation) ? gravs[1] :-gravs[0];
	} 
 
	public float getY() { 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager
     * @param bmp          The Bitmap of the part we want to add to the destination activity 
     * @param loc          The location this part should be on the screen 
     * @return 
     */ 
    private static ImageView createImageView(Activity destActivity, Bitmap bmp, int loc[]) {
    	MyImageView imageView = new MyImageView(destActivity);
        imageView.setImageBitmap(bmp);
        imageView.setImageOffsets(bmp.getWidth(), loc[0], loc[1]);                     
         
        WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams();
        windowParams.gravity = Gravity.TOP;
        windowParams.x = 0;
        windowParams.y = loc[2] + loc[0];
        windowParams.height = loc[1] - loc[0];
        windowParams.width = bmp.getWidth();
        windowParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
        windowParams.format = PixelFormat.TRANSLUCENT;
        windowParams.windowAnimations = 0;
        destActivity.getWindowManager().addView(imageView, windowParams);
 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager
        BackupManager.dataChanged(name);
    } 
 
    @Override 
    public int getRotationOffset(final Activity activity) {
        switch (activity.getWindowManager().getDefaultDisplay().getRotation()) {
            case Surface.ROTATION_90:
                return 90; 
            case Surface.ROTATION_180:
                return 180; 
            case Surface.ROTATION_270:
                return 270; 
            default: 
                return 0; 
        } 
    } 
 
    @Override 
    public File getExternalPictureDir() {
        return Environment.getExternalStoragePublicDirectory(
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager, getResources
		super(); 
	} 
 
	public void init(Activity context) {
		metrics = new DisplayMetrics();
		resources = context.getResources();
		context.getWindowManager().getDefaultDisplay().getMetrics(metrics);
//		options.inScaled = false; 
	} 
	 
	public Drawable getDrawable(String name) {
		return getDrawable(name, false, false, true);
	} 
	 
	public Drawable getDrawable(String name, boolean tileX, boolean tileY, boolean eternal) {
		String extra = "";
		int hashIndex = name.indexOf('#');
		 
		if(hashIndex >= 0) {
			extra = name.substring(hashIndex, name.length());
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindow, getWindowManager
				android.R.drawable.stat_sys_phone_call);
		return ico.getIntrinsicHeight();
	} 
 
	public static void setActivitySizePos(Activity activity) {
		WindowManager m = activity.getWindowManager();
		Display d = m.getDefaultDisplay();
		WindowManager.LayoutParams p = activity.getWindow().getAttributes();
		p.y = 4;
		p.height = (int) (d.getHeight() - 72);
		activity.getWindow().setAttributes(p);
	} 
 
	public static int dipToPx(int dip) {
		if (dm == null) {
			return -1; 
		} 
		return (int) (dip * dm.density + 0.5f);
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager
        // do nothing 
    } 
 
    @Override 
    public int getRotationOffset(Activity activity) {
        final Display display = activity.getWindowManager().getDefaultDisplay();
        final int rotation = display.getOrientation();
        if (rotation == Configuration.ORIENTATION_LANDSCAPE) {
            return 90; 
        } 
        return 0; 
    } 
 
    @Override 
    public File getExternalPictureDir() {
        // Use externalStorage/Pictures as default 
        return new File(Environment.getExternalStorageDirectory(), "Pictures");
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindow, getWindowManager
		return ico.getIntrinsicHeight();
	} 
 
	@SuppressWarnings("deprecation") 
	public static void setActivitySizePos(Activity activity) {
		WindowManager m = activity.getWindowManager();
		Display d = m.getDefaultDisplay();
		WindowManager.LayoutParams p = activity.getWindow().getAttributes();
		p.y = 4;
		p.height = (int) (d.getHeight() - 72);
		activity.getWindow().setAttributes(p);
	} 
 
	public static int dipToPx(int dip) {
		if (dm == null) {
			return -1; 
		} 
		return (int) (dip * dm.density + 0.5f);
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getWindowManager
        BackupManager.dataChanged(name);
    } 
 
    @Override 
    public int getRotationOffset(final Activity activity) {
        switch (activity.getWindowManager().getDefaultDisplay().getRotation()) {
            case Surface.ROTATION_90:
                return 90; 
            case Surface.ROTATION_180:
                return 180; 
            case Surface.ROTATION_270:
                return 270; 
            default: 
                return 0; 
        } 
    } 
 
    @Override 
    public File getExternalPictureDir() {
        return Environment.getExternalStoragePublicDirectory(
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Activity getWindowManager Questions & Answers:

Other Activity getWindowManager Examples

24:	    super.onCreate(savedInstanceState);
25:	    setContentView(R.layout.target);
26:	    width = getWindowManager().getDefaultDisplay().getWidth();
27:	    height = getWindowManager().getDefaultDisplay().getHeight();
28:	    randon = new Random();
-
25:	    setContentView(R.layout.target);
26:	    width = getWindowManager().getDefaultDisplay().getWidth();
27:	    height = getWindowManager().getDefaultDisplay().getHeight();
28:	    randon = new Random();
29:

Read More

getWindowManager Method Overview
Retrieve the window manager for showing custom windows.
See Code Examples for other Android Activity Methods: