Every great man begins his programming journey with the first line of code. Here is an article to share with you today, together with zero to one implementation of Android welcome interface ~

Android implements the welcome interface

Android projects implement the welcome interface

When we use the software, when we open an application, the welcome interface will appear first. It is not only the entrance of the application, but also a simple summary of the functions of the app, which has a beautiful effect. At the same time, while displaying the welcome interface, we can preload the data of the home page, which can make our UI smoother and user experience better. It is worth noting that there are two types of welcome screens:

  • Welcome screen on first installation
  • The welcome screen when the application is first started (without closing)

1. Distinguish between the two welcome screens

To distinguish between the two welcome interfaces, we can do this by setting the key pair value in sharePreference to the version number.

  1. If the key pair value is empty, that is, the specified key value does not exist, the APP is not installed, and the first welcome interface is used.
  2. If there are key pair values, the second welcome screen is used.

Store key pair values:

SharedPreferences sp=getSharedPreferences("appDetails", Context.MODE_PRIVATE);
sp.edit().putString("welcome",welcome).apply();

Copy the code

Read key pair values:

SharedPreferences sp=getSharedPreferences("appDetails", Context.MODE_PRIVATE);
welcome=sp.getString("welcome",null);

Copy the code

2. Simple implementation of the welcome interface

This is where the second, most common, welcome interface is implemented. The first kind of welcome interface is similar and can be implemented using a wheel view or viewPage. To realize the second welcome interface, the main consideration is that the welcome interface should be kept for a period of time to load some resources required by the main page, check the version number and check the token, which can make the user experience better. Here, 2s is taken as an example. There are two common methods to realize delayed jump, one is Handler and the other is Timer.

public class Welcome extends AppCompatActivity { public String welcome; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); SharedPreferences sp=getSharedPreferences("appDetails", Context.MODE_PRIVATE); welcome=sp.getString("welcome",null); If (welcome==null){// The code to display the first welcome screen...... (omitted) sp.edit().putString("welcome","1").apply(); } else{ //plan1 timer // new Timer().schedule(new TimerTask() { // @Override // public void run() { // startActivity(new  Intent(getApplicationContext(), home.class)); // finish(); //} //, 2000); // handler new handler (new handler.Callback() {Override public Boolean handleMessage(Message MSG) {  startActivity(new Intent(getApplicationContext(), home.class)); finish(); return false; }}). SendEmptyMessageDelayed (0200); }}}Copy the code

In fact, there is simply a delay in the welcome interface. During this time, we can check whether the software version needs to be updated, check whether the token needs to be re-logged in, test whether the server is down, preload the home page, and so on. Since these are related to things after the project, some of them haven’t been written yet, we will refine the welcome screen delay process later.

Android Learning Guide

Android development is a lot more competitive now than it used to be.

Android learning road need to learn a lot of things, here to give you a learning route for your reference.

(This is from a big guy’s public account, you can click here to see the original article)

  • The architect builds the base language foundation

At present, the mainstream Android APP development language is Java language, the biggest feature of Java language is to improve the possibility of software interaction, it can be said that almost all applications of Android phones are written using Java language.

Knowledge points:

3. Concurrent programming 4. Data transfer and serialization 5. The Principle of Java Virtual Machine 6

  • Design ideas read open source frameworks

With the continuous development of Internet enterprises, there are more and more modules in product projects, and the user experience requirements are getting higher and higher. It is more and more difficult to achieve the purpose of small steps and rapid iteration, so plug-in technology is born. Without plug-in technology, meituan and Taobao, which integrate a large number of “apps”, would be several gigabytes in size.

As a result, Android mobile development today is not hotfix, plug-in, componentized, and 80% of interviews fail.

Knowledge points:

1. Hot repair design; 2. Plug-in framework design; 3. Component framework design; 4

  • 360° all-round performance tuning

In the hands of development engineers at different levels, due to the uneven technical level, even though many mobile phones have very high performance of scoring software, there is still a lag phenomenon when opening applications.

In addition, as product content iterates and features become more complex, the UI pages become richer, which can become a barrier to smooth operation. To sum up, APP performance optimization has become a comprehensive quality that developers should have, and it is also a guarantee that developers can complete high-quality application works.

Knowledge points:

1. Design idea and code quality optimization 2. Program performance optimization startup speed and execution efficiency optimization layout detection and optimization memory optimization power consumption optimization network transmission and data storage optimization APK size optimization

3. Optimization of development efficiency

Git automatic build system Gradle

4. Actual project combat

Start speed fluency Douyin in APK package size resource optimization practice Youku responsive layout technology full analysis network optimization mobile Phone Taobao Double eleven performance optimization project revealed Autonavi APP full link source code dependency analysis completely eliminate OOM actual experience sharing wechat Android terminal memory optimization practice

  • Android framework architecture

Android FrameWork architecture (advanced UI+FrameWork source code) this piece of knowledge is the most users today, we call Android2013~2016 technology.

Android developers also tend to be familiar with the “used” code because they are used to online Copy code. The familiar is that they work with it almost every day and Copy it every day. What is strange is that although I deal with these codes every day, I have not studied the principle of these codes and the connotation of the code.

Knowledge points:

1, advanced UI promotion 2, Android kernel components 3, large project essential IPC 4, data persistence and serialization 5, Framework kernel parsing **

  • NDK module development (Audio and Video development series)

NDK (Native Development Kit) A software Development Kit based on a Native programming interface that allows you to leverage C and C++ code in Android applications. Programs developed with this tool run directly locally, rather than on a virtual machine.

In Android, the NDK is a collection of tools that extend the Android SDK. The NDK provides a set of tools to help developers quickly develop dynamic libraries in C or C++, and automatically package so and Java applications together as APK.

Knowledge points:

1, NDK development of C/C++ introduction 2, JNI module development 3, Linux programming 4, underlying picture processing 5, audio and video development 6, machine learning

  • Flutter learning is advanced

2020 is undoubtedly the year that Flutter technology is in full swing. This technology is still very valuable.

Every mobile developer has been fascinated by the features and ideas that Flutter brings with it: “rapid development, expressive and flexible UI, native performance”, from superapps to standalone apps, from pure Flutter to hybrid stacks, Developers have been exploring and applying Flutter technology in a variety of scenarios and are facing a variety of challenges.

Knowledge points:

1, Build your first Flutter application on Windows 2, Build your first Flutter application on Windows 3, Build your first Flutter Application on Windows 3, Build your first Flutter Application on Windows

  • Wechat small program development

Wechat small program as one of the more popular programming development application scenarios, favored by the market, which makes many developers greedy. But for beginners, it is completely confused, do not know the micro channel small program development and production need to learn those knowledge, friends in need can refer to this article.

Knowledge points of this article:

Small program overview and introduction 2. Small program UI development 3. API operation 4

  • Android related source code interpretation

Here you can check out this article:Cow bye! Ali P7 big shot half a month, android source code analysis into 508 pages of PDF.

The full material has been compiled into PDF files,Interested friends can click here, quickly get!I hope I can help you!