Code example for Intent

Methods: getParcelableExtragetStringExtrahasExtra

0
	} 
 
	@Kroll.method 
	public String getStringExtra(String name)
	{ 
		if (!intent.hasExtra(name)) {
			return null; 
		} 
 
		String result = intent.getStringExtra(name);
		if (result == null) {
			// One more try as parcelable extra, such as when it's a Uri. 
			// We can't really support getParcelableExtra(name) by itself, 
			// since the type of object coming out of it is unknown and 
			// might not make its way successfully over to Javascript. 
			// By getting it as a string, we at least allow people to grab 
			// Uris (Intent.STREAM) stored as parcelable extras, which is a 
			// very common use case. 
			Object parcelable = intent.getParcelableExtra(name);
			if (parcelable != null) {
				result = parcelable.toString();
			} 
		}