Android, intent explicit and implicit intent intent

1. Display intent:
very simple, just know that the target java file location and name.
Then write:
the Intent the Intent Intent new new = (the this, Activity.class );
startActivity (Intent);
blackbody portion is the target Activity.

2. implicit intent:
the first open AndroidManifest.xml file in the file manifests, then you can add brackets around the target area is defined Activity:

<activity android:name=".Activity"><intent-filter>
                <action android:name="cn.itcast.START_ACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />

Then the original file java wrote:

 Intent intent=new Intent();

Where the <action android:name="cn.itcast.START_ACTIVITY" />
string section can write your own.

By definition, we should ensure action and category corresponding to the value equal to the job, but with the general category of name as the default, so you can write setAction only java files, because then automatically add the default category value.

Published 35 original articles · won praise 0 · Views 1282

Guess you like