Android uses MVP mode (I)

I studied MVP before, but it didn't work for a long time. Today I watched it again. In fact, MVP is the upgraded version of MVC. MVP includes M-Model-model, V-View-view and C-Controller-controller. Make a simple example, simple login. First, create a new project and create a layout. <?xml version="1.0" encoding="utf-8"?&gt ...

Added by Stickdragon on Tue, 31 Dec 2019 06:19:49 +0200

Using LiveData to handle events

Today, a strange thing happened. An Activity(A) was created after it was closed on the colleague's mobile phone. After debugging, it was found that every time the Activity(A) was closed, the life cycle of the previous Activity(B) would be triggered. Then the subscribed LiveData object would receive the OnChange message to creat ...

Added by konetch on Sun, 29 Dec 2019 21:52:12 +0200

Download in webview using AsyncTask download (8.0 compatible)

Download in webview using AsyncTask download (8.0 compatible) Write a class to inherit Asynctask, and download its file with Httpconnection in doinbackground. Postexecute is to open the download file (apk) after the download is completed private class DownloadTask extends AsyncTask<String, Void, Void> { // Pass tw ...

Added by cjbeck71081 on Sun, 29 Dec 2019 21:32:32 +0200

iOS project clear unused pictures

Preface iOS projects usually put pictures into Image Assets to manage pictures. After iterating several versions, some pictures may not be deleted in time. These pictures will make the project larger, so they need to be cleaned regularly. Android can do this using Lint, and iOS can easily do it using Python scripts. 1, Insta ...

Added by christophe on Sun, 29 Dec 2019 19:16:49 +0200

Android Studio uses ViewPager + Fragment to achieve the effect of sliding menu Tab -- simple version

Description: I have done a bookkeeping APP before. It is easy to practice. It is developed with Eclipse; Recently, I want to improve this APP, add some new functions, and choose Android Studio to develop it; APP has improved a part of it. Now I want to sort out and record the functions that have been done.   Design sketch: You can slide the men ...

Added by zeth369 on Wed, 25 Dec 2019 18:48:14 +0200

Custom TextView - custom View, custom attribute base case

User defined view is the basis of Android development. There are not too many difficulties in itself, and there are not many knowledge points to be considered, mainly including canvas drawing related knowledge, view control measurement, user-defined attributes, etc. in this case, we try to demonstrate the above knowledge points ...

Added by therealairness on Tue, 24 Dec 2019 17:37:07 +0200

Hardcore explains Jetpack's life cycle source code

Previous Hard core explains the use of life cycle of Jetpack This paper mainly introduces the significance of life cycle, basic and advanced use methods. Today, I don't want to talk much about it, just start rolling source code. This article is based on the android_9.0.0_r45 Source code, all relevant source code including comments have been upl ...

Added by jeffwhite on Mon, 23 Dec 2019 23:58:25 +0200

Log printing class -- LogUtils

In Android development, it is often necessary to print logs, but the system logs, first, need to write tags frequently, but tags often use the same, second, can't output the number of lines, third, the logs that may be printed are very long and can't be printed completely, so a simple log printing class is needed to write less ...

Added by php_dev_101 on Mon, 23 Dec 2019 00:25:05 +0200

6, opencv ndk environment building (cmake mode)

opencv full name open source compute vision, open source visual Library 1, Preparations The steps to import opencv are relatively simple. The preparation steps are divided into the following three steps: Download opencv android sdk https://opencv.org/releases.html Copy opencv Android SDK / SDK / native / LIBS to jniLibs of ...

Added by superpimp on Fri, 20 Dec 2019 22:03:31 +0200

android floating layout

1. gravity: floats internal elements. A view (TextView,ImageView,ImageButton...) is a div, but it can't have flow: left|right and other attributes like a Div. if you don't want to use floating positioning, you can add a third-party dependency. The usage is as follows: //Add dependency in build compile 'com.nex3z:flow-layout: ...

Added by starnol on Fri, 20 Dec 2019 18:11:26 +0200