Skip to content

nichbar/YourName

Repository files navigation

YourName

YourName is a Android library.
You can generate your own Chinese name with it.

Download

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Then add the dependency:

dependencies {
	compile 'com.github.nichbar:YourName:v1.0'
}

Usage

Generate a random Chinese name with three characters

Use generateName()

YourName yourName = new YourName();
Toast.makeText(this, yourName.generateName(), Toast.LENGTH_SHORT).show();

Generate a random Chinese name with custom length

Use generateName(int length)

YourName yourName = new YourName();
Toast.makeText(this, yourName.generateName(YourName.TWO_CHARACTER), Toast.LENGTH_SHORT).show();

Only family name

Use generateFamily(int length)

YourName yourName = new YourName();
Toast.makeText(this, yourName.generateFamily(YourName.ONE_CHARACTER), Toast.LENGTH_SHORT).show();

Only given name

Use generateGivenName(), only one character will return. You may call twice to get two characters.

YourName yourName = new YourName();
Toast.makeText(this, yourName.generateGivenName(), Toast.LENGTH_SHORT).show();

TODO

  • Generate names with FengShui option.

Thanks

chinese-random-name by XadillaX