Created
March 9, 2019 02:46
-
-
Save Trumeet/ca0288a141f7ad4d7bf0b5933c4acac0 to your computer and use it in GitHub Desktop.
Create UserHandle instance without using hidden APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object UserHandleUtils { | |
private fun createUserHandleWithUserID(userId: Int): UserHandle { | |
val parcel = Parcel.obtain() | |
// I bet that it won't change a lot | |
parcel.writeInt(userId) | |
val userHandle = UserHandle(parcel) | |
parcel.recycle() | |
return userHandle | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment