Category:Android

  • Summary of Android version and permission adaptation

    Time:2021-8-2

    catalogue Request storage permissions Version adaptation Before Android 7.0 After Android 7.0 Android 10.0 What is scope Take a chestnut Request storage permissions First, you need to declare permissions in the androidmanifest.xml file: <uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE” /> Request user permissions in Code: //Permission request code private static final int PERMISSION_REQ_ID = 0; //Request permission private static […]

  • How does flutter set the main tone and font of the app

    Time:2021-8-1

    The theme color and font of shutter can be set in materialapp, that is, the global main color and font can be set uniformly in the materialapp component returned at the entrance of main.dart. As shown in the following code: class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( Title: ‘app framework’, […]

  • Android uses table layout to design the registration interface

    Time:2021-7-31

    Android uses table layout to design the registration interface for your reference. The specific contents are as follows The registration page includes: user name, password, confirmation password and verification code. The verification code is generated using an encapsulated tool class and can be used directly. The renderings are shown below. No event handling, just a […]

  • Flitter uploads files directly to alicloud OSS

    Time:2021-7-30

    catalogue code implementation Example of calling upload Another way preparation: Give a tool class code implementation The following is a class I wrote to upload OSS. You can directly upload OSS by replacing the parameters ossaccesskeyid, ossaccesskeysecret, bucket, URL and expiration import ‘dart:convert’; import ‘dart:io’; import ‘dart:math’; import ‘package:crypto/crypto.dart’; import ‘package:dio/dio.dart’; class UploadOss { static […]

  • The following methods for changing the font of immersive navigation bar in Android 6.0 (only valid for some mobile phones)

    Time:2021-7-30

    This method is only valid for some phones below Android 6.0 (the color can be modified successfully). If it is invalid, the navigation bar is translucent and the font can be seen. Android immersive navigation bar is very common, which can “integrate” the status bar with the title bar of the mobile phone and look […]

  • Android serialization 36 – query data, use of native SQL and use of transactions

    Time:2021-7-29

    1、 Query data Android’s query database operation is very complex. Sqlitedatabase uses the query method to find data, which contains many parameters. Let’s take a look Query() method parameters Corresponding SQL part describe table from table_name Table name colums select colum1,colum2 Column name to query selection where column = value constraint condition selectionArgs – Provide […]

  • Android realizes the progress effect of text dynamic highlight reading

    Time:2021-7-29

    This example shares the specific code for Android to realize the dynamic text highlight reading progress for your reference. The specific contents are as follows 1. Renderings Similar to the effect of lyrics. Play the audio of the following text, and the audio playback progress shall be consistent with the text highlighting progress. 2. Code […]

  • Pit and summary in the development of Android widget

    Time:2021-7-28

    @ catalogue summary Official reference design sketch AndroidManifest.xml Receiver Service Options res/xml/ widget_desktop_options.xml Common parameters Size updatePeriodMillis initialLayout Using App Widgets with Collections Official reference AppWidgetProvider RemoteViewsService RemoteViewsFactory DesktopActivity summary Official reference Build an App Widget design sketch Put a rendering. This is the desktop app folder I play AndroidManifest.xml Receiver Remember not to make […]

  • Transparent animation for Android

    Time:2021-7-28

    This example shares the specific code of Android transparent animation for your reference. The specific contents are as follows There is an activity on the home page public class AlphaAnimationActivity extends AppCompatActivity { private ImageView mImageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_frame_animation); //It’s just an ordinary picture mImageView = findViewById(R.id.imageview); … here are […]

  • Android serial 37 – sharing data across programs

    Time:2021-7-27

    1、 Content provider Use content providers to share data It can accurately control which data can be shared and which data cannot be shared The content provider has two uses: (1) use the existing content provider to read and operate the data in the corresponding program( 2) Create your own content provider to provide external […]

  • Android messenger enables two-way communication between processes

    Time:2021-7-27

    brief introduction Messenger is the simplest way of Android interprocess communication (IPC), which can realize two-way communication between processes. See the official website for details code implementation Server application implementation Messengerservice receives messages sent by the client: package com.test.messengerservice; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.util.Log; […]

  • Use messenger to realize two-way communication of service

    Time:2021-7-26

    There is a solution in the Android architecture: use Android messenger to realize two-way communication between service processes. Mainactivity class: package com.example.messengeservicetest; import android.app.Activity; import android.app.Service; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.text.style.IconMarginSpan; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MainActivity […]