Vapor Intent
A VaporIntent plays the same role in the Vapor Android framework as a standard Intent does in Android.
Creating A VaporIntent
VaporIntent has two constructors, one of which takes your existing Android Intent and encapsulates it. All of the existing data stored within the
Intent is preserved, and thereafter available via the VaporIntent methods.
Intent myAndroidIntent;
...
$.Intent(myAndroidIntent); // encapsulate an existing Intent
Secondly, you can instantiate a VaporIntent using a Context and the Class
representing the specific component for which you are creating the intent. This is particularly useful when are you do not have an existing Intent object already.
$.Intent(activity, serviceClass); // using a Context and Class
Storing Extras
VaporIntent is akin to VaporBundle and VaporSharedPreferences
in that they are fluent objects with a heavily
overloaded .put(...) method.
This means you can chain calls like in jQuery, and use .put(...) methods without having to worry about the actual datatype
of the item that you are committing to the intent.
$.Intent(activity, serviceClass)
.put("someExtra", 25)
.put("anotherExtra", "this is so easy!");
VaporIntents are used predominantly in conjunction with existing standard Android framework APIs that expect to be given Intents.
Unlike VaporBundles, VaporIntents do not currently
support storage of arbitrary reference types because these would be lost when the VaporIntent was converted to a standard Android Intent.
Retrieving Extras
Developers should use the appropriate .get____(String) method depending on the datatype being retrieved:
// Retrieve an Integer
Integer integer = vaporIntent.getInt("someKey");
// Retrieve array of Doubles
Double[] doubles = vaporIntent.getDoubles("someOtherKey");
// Retrieve list of Strings
ArrayList<String> strings = vaporIntent.getStringList("anotherKey");
Type Hierarchy
All of the public methods found in standard Android Intents are available on VaporIntents as fluent methods,
however a VaporIntent does not extend from Intent.
Despite this, you can easily extract the underlying
standard Intent object using .intent() for compatibility with standard Android framework APIs.
VIntent<Intent> vaporIntent = $.Intent(activity, serviceClass);
...
// compatibility with existing Android framework APIs
Intent androidIntent = vaporIntent.intent();
See the docs on VaporIntent for more details...

