viblo.asia

Interface Singleton trong Kotlin

Object declaration trong Kotlin là một tính năng tiện lợi, được sử dụng để tạo một thực thể singleton trong khi tránh boilerplate. Tuy nhiên, nó cũng là một tính năng rất khắt khe, theo nghĩa là một object nhất thiết phải là final. Điều này có nghĩa là ta không thể mở rộng từ nó. Điều này có thể trở thành một vấn đề khi refactor code. Theo nguyên tắc chung, việc truy cập thực thể singleton trực tiếp đi ngược lại nguyên tắc của...

programmer group

Reaction-native-wechat Android Click Logon No Callback Problem

Third-party login and sharing will inevitably be used in the project. The third-party components used in Wechat login in this project are as follows:#react-native-wechat Use yarn add react-native-wechat react-native link react-native-wechat Create a new wxapi folder under the package name and a new file WXEntryActivity. Java under the folder package com.xxx.wxapi; import android.app.Activity; import android.os.Bundle; import com.theweflex.react.WeChatModule; public class WXEntryActivity extends Activity { @Override protected...

programmer group

Android - A shortcut commonly used in Android Studio

lookup Double ShiftGlobal Find File/Method Ctrl + Shift + FGlobal search keywords edit Ctrl + XShear line Ctrl + YDelete row Ctrl + DReplication row Shift + F6Renaming a variable Ctrl + Alt + MExtraction method Ctrl + Alt + LAutomatic Formatting Code Alt + Shift + Up/DownUp and down mobile code Other and Live Temple logtAutomatic insertion of generated TAG logd, logeAutomatic insertion of Log output statement Alt + InsertCommon methods such as insertion construction, getters/setters, etc. Ctrl + NOpen class file Ctrl + JLive Temple...

programmer group

Android Quick Start-Actual Warfare: Music Player

Player 1.0 Basic function realization: Playlist: Generate basic Music classes package com.example.playaudiotest.model; public class Music { private int musicId; private String musicName; private String musicWriter; private String musicAlbum; private int musicImageId; private String musicPath; private int musicDuring; // Format, sound quality, comments public Music(int musicId, String musicName, String musicWriter, String musicAlbum, int musicImageId, String musicPath , int musicDuring) { ...

programmer group

Android API Demo Program Framework

Links to the original text: https://my.oschina.net/fuyajun1983cn/blog/263880 Preface android API Demo program mainly demonstrates the use of common Android APIs. This paper extracts the framework of the program as an example collection framework for my own research and learning of Android programming. It collects all the examples I have studied according to classification, so as to facilitate future...

programmer group

Android remote shell command control and whitelist

How to use java code to execute shell commands in Android system In java, we can't run shell commands directly. We need to use Runtime class to execute shell commands. Runtime's introduction, I can't say it clearly, is not a mistake for our children. But it is emphasized that Runtime class is a villain singleton pattern. When jvm is created, objects are created and constructed. Methods are also private constructs, so we need to get the object of the Runtime class through Runtime.getRuntime(), with some source code attached below. public...