I want to pass Bitmap
as an argument to another fragment using safe args. what is the correct argType
for passing a bitmap.
<fragment
android:id="@+id/nextFragment"
android:name="com.example.----.NextFragment"
android:label="fragment_next"
tools:layout="@layout/fragment_next" >
<argument
android:name="image"
app:argType="???"
android:defaultValue="???" />
</fragment>
you can add argType as android.graphics.Bitmap
from the source code of NavType.java
Class clazz = Class.forName(className);
if (Parcelable.class.isAssignableFrom(clazz)) {
return new ParcelableType(clazz);
} else if (Enum.class.isAssignableFrom(clazz)) {
return new EnumType(clazz);
} else if (Serializable.class.isAssignableFrom(clazz)) {
return new SerializableType(clazz);
}
And Bitmap implements parcelable, so it will work.
You can remove the defaultValue