Some time ago, I decided to insist on writing a blog, but found that I didn’t have much accumulation, so I went to the library during the holidays and read some valuable articles. I have gained a lot, and today's articles are shared as the main point and I will learn together.
Why do you need to write explicit start and implicit start activities? This stems from an interview with Baidu engineers, but later I felt that my answer was not good, so I didn't say nonsense and got to the point.
As the question is, there are roughly two ways to start the Activity of Android: explicit start and implicit start. The following are introduced separately:
A: Explicitly start
For beginners, this is the most common. The following code is used to explain what explicit startup is.
Intent intent=new Intent(, );
startActivity(intent);
B: Implicit startup
The difference between implicit startup is that we don't need to pass parameters like Intent(, ) and then start another activity. We need to add a filter intentfilter to the intent.
<activity android:name="" android:label="@string/title_activity_main" > <intent-filter> <action android:name=""/> <category android:name="" /> </intent-filter> </activity>
In this way, we need to start another activity just need the following method:
Intent intent=new Intent("");
startActivity(intent);
This example will be clearer. Because I am not used to web editing blog posts and am not familiar with the upload of attachments, I will not upload projects. The most important thing is to do more!