References in Java and JNI (strong, soft, weak, virtual)

1. Strong References (Objects) Features: Strong references provide direct access to the target object. Will not be recycled. Two, soft reference (SoftReference class) Features: When GC reclaims based on JVM memory, JVM reclaims when it finds it is out of memory Conditions for freeing up space: JVM found insufficient m ...

Posted by alireza on Sun, 19 Jul 2020 08:34:35 -0700

Shake like WeChat

Shake function 1. Get Sensor Management Classes SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); 2. Inherit the SensorEventListener interface and override sensor listening methods @Override public void onSensorChanged(SensorEvent event) { /** * 1,Get the sensor type ( ...

Posted by thomasadam83 on Sat, 18 Jul 2020 09:06:41 -0700

Dynamically set the width and height of the imageview in HorizontalScrollView

The demand is as follows: There are two kinds of pictures to display, one is 640*640 and the other is 1920*1080. If it is a 1920 picture, you need to double-click to switch the display mode. By default, the middle part of 1920 is displayed by 640*640, which allows you to swipe left and right to view the entire picture ...

Posted by greenie__ on Fri, 17 Jul 2020 08:38:57 -0700

Dynamically set the width and height of the imageview in HorizontalScrollView

The demand is as follows: There are two kinds of pictures to display, one is 640*640 and the other is 1920*1080. If it is a 1920 picture, you need to double-click to switch the display mode. By default, the middle part of 1920 is displayed by 640*640, which allows you to swipe left and right to view the entire picture ...

Posted by ranam on Fri, 17 Jul 2020 08:39:10 -0700

Android login registration interface add video background method (simple version)

Describes how to add a video background to the interface found on the Internet, which mimics keep 1. First add the raw folder under the res folder and copy in the video you want to use 2. Add video_under the layout folderBackground.xmlLayout, add Videview control inside layout 3. Change AndroidManifest.xml Content removes Bar from the disp ...

Posted by GrayFox12 on Thu, 16 Jul 2020 08:04:36 -0700

Android Start Page Advertising

1. Preface In the development of Android projects, there is often a need to launch page ads.Today I'll start the implementation of page advertisement in order to use it for reference in future projects. 2. Overview Ideas for implementation: 1. During the initialization phase of the startup page, access the back-en ...

Posted by cowboysdude on Wed, 15 Jul 2020 09:12:34 -0700

android exceptions collect error information and save it to the crash folder

Save the log file to the sdcard, directory: crash folder under the sdcard root directory First, set permissions, no permissions to the final effect <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>Two classes must be crea ...

Posted by falcon1 on Wed, 15 Jul 2020 08:11:06 -0700

Android evokes app in many ways

Method 1 (aroused by Intent) Our own app Code: ComponentName componetName = new ComponentName( "com.lh.jimtrency.webviewdemo", "com.lh.jimtrency.webviewdemo.MainActivity"); //(package name of another application, Activity to start) Bundle bundle = new Bundle(); ArrayList<String> strings=new ArrayLis ...

Posted by kaze on Tue, 14 Jul 2020 08:49:12 -0700

Summary of Bluetooth Development Experience - Automatic Pairing

Scene: Control side - ordinary mobile phone; Controlled side - XX device (no screen, no user operation, system privileges) There are two ways to find a device when Bluetooth is on: search and specify a mac.Searching for Bluetooth devices with the search function involves the concept of "visibility". Bluetooth ...

Posted by laflair13 on Tue, 14 Jul 2020 08:33:04 -0700

Summary of Bluetooth Development Experience - Automatic Pairing

Scene: Control side - ordinary mobile phone; Controlled side - XX device (no screen, no user operation, system privileges) There are two ways to find a device when Bluetooth is on: search and specify a mac.Searching for Bluetooth devices with the search function involves the concept of "visibility". Bluetooth ...

Posted by grga on Tue, 14 Jul 2020 08:32:35 -0700