Code example for Point

Methods: getSize

0
	} 
 
	@TargetApi(13) 
	void GetScreenSizeHC(Point size) { 
        WindowManager w = getWindowManager(); 
		w.getDefaultDisplay().getSize(size); 
	} 
	 
	void GetScreenSize(Point size) { 
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { 
			GetScreenSizeHC(size); 
		} else { 
	        WindowManager w = getWindowManager(); 
	        Display d = w.getDefaultDisplay(); 
			size.x = d.getWidth(); 
			size.y = d.getHeight(); 
		} 
	} 
	 
	public void Initialize() { 
        if (Build.VERSION.SDK_INT >= 9) { 
        	// Native OpenSL is available. Let's use it! 
        	useOpenSL = true; 
        } 
        if (Build.VERSION.SDK_INT >= 17) { 
        	// Get the optimal buffer sz 
        	detectOptimalAudioSettings(); 
        } 
 
        /* 
        if (NativeApp.isLandscape()) { 
    		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 
    	} else { 
    		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
    	}*/ 
    	Log.i(TAG, "onCreate"); 
    	// Get system information 
		ApplicationInfo appInfo = null;   
		PackageManager packMgmr = getPackageManager(); 
		String packageName = getPackageName(); 
		try { 
		    appInfo = packMgmr.getApplicationInfo(packageName, 0); 
	    } catch  (NameNotFoundException e) { 
		    e.printStackTrace(); 
		    throw new RuntimeException("Unable to locate assets, aborting..."); 
	    } 
		String libraryDir = getApplicationLibraryDir(appInfo); 
	    File sdcard = Environment.getExternalStorageDirectory(); 
        Display display = ((WindowManager)this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
		@SuppressWarnings("deprecation") 
        int scrPixelFormat = display.getPixelFormat(); 
        Point size = new Point(); 
        GetScreenSize(size); 
        int scrWidth = size.x; 
        int scrHeight = size.y; 
		 
        float scrRefreshRate = display.getRefreshRate(); 
	    String externalStorageDir = sdcard.getAbsolutePath();  
	    String dataDir = this.getFilesDir().getAbsolutePath(); 
		String apkFilePath = appInfo.sourceDir;  
		NativeApp.sendMessage("Message from Java", "Hot Coffee"); 
		DisplayMetrics metrics = new DisplayMetrics(); 
		getWindowManager().getDefaultDisplay().getMetrics(metrics); 
		int dpi = metrics.densityDpi; 
		 
		String deviceType = Build.MANUFACTURER + ":" + Build.MODEL; 
		String languageRegion = Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry();  
				 
		// INIT! 
		NativeApp.audioConfig(optimalFramesPerBuffer, optimalSampleRate); 
		NativeApp.init(scrWidth, scrHeight, dpi, deviceType, languageRegion, apkFilePath, dataDir, externalStorageDir, libraryDir, installID, useOpenSL); 
	    Log.i(TAG, "Device: " + deviceType);      
	    Log.i(TAG, "W : " + scrWidth + " H: " + scrHeight + " rate: " + scrRefreshRate + " fmt: " + scrPixelFormat + " dpi: " + dpi);      
		 
 		// Initialize Graphics 
         
        if (!detectOpenGLES20()) { 
        	Log.i(TAG, "OpenGL ES 2.0 NOT detected."); 
        } else { 
        	Log.i(TAG, "OpenGL ES 2.0 detected."); 
        } 
     
        /* 
        editText = new EditText(this); 
        editText.setText("Hello world"); 
         
        addContentView(editText, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 
        */ 
        // inputBox("Please ener a s", "", "Save"); 
		// Toast.makeText(this, "Value: " + input.getText().toString(), Toast.LENGTH_LONG).show(); 
	 
	} 
	 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
		super.onCreate(savedInstanceState);  
    	installID = Installation.id(this); 
 
		if (!initialized) { 
			Initialize(); 
			initialized = true; 
		} 
		// Keep the screen bright - very annoying if it goes dark when tilting away 
		Window window = this.getWindow(); 
		window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
		setVolumeControlStream(AudioManager.STREAM_MUSIC); 
 
		if (!useOpenSL) 
        	audioPlayer = new NativeAudioPlayer(); 
        NativeApp.audioInit(); 
         
        Point size = new Point(); 
        GetScreenSize(size); 
        NativeApp.resized(size.x, size.y); 
         
        mGLSurfaceView = new NativeGLView(this); 
        //setup the GLSurface and ask android for the correct