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
JNIEXPORT void JNICALL method_name | |
(JNIEnv *env, jobject obj, jstring jstr) | |
{ | |
const char* ch = env->GetStringUTFChars(jstr, 0); | |
env->ReleaseStringUTFChars(jstr, ch); | |
} |
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
static std::string getClassName(JNIEnv *env, jobject entity, jclass clazz) | |
{ | |
jmethodID mid = env->GetMethodID(clazz, "getClass", "()Ljava/lang/Class;"); | |
jobject clsObj = env->CallObjectMethod(entity, mid); | |
jclass clazzz = env->GetObjectClass(clsObj); | |
mid = env->GetMethodID(clazzz, "getName", "()Ljava/lang/String;"); | |
jstring strObj = (jstring)env->CallObjectMethod(clsObj, mid); | |
const char* str = env->GetStringUTFChars(strObj, NULL); | |
std::string res(str); |
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
@interface UIColor (Hex) | |
+ (CGFloat)colorComponentFrom:(NSString *)string start:(NSUInteger)start length:(NSUInteger)length; | |
@end | |
@implementation UIColor (Hex) | |
+ (UIColor *)colorWithHexString:(NSString *)hex | |
{ |
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
CGFloat h = (arc4random() % 128 / 256.0) + 0.5; | |
CGFloat s = (arc4random() % 128 / 256.0) + 0.5; | |
CGFloat b = (arc4random() % 128 / 256.0) + 0.5; | |
UIColor *color = [UIColor colorWithHue:h saturation:s brightness:b alpha:1.0f]; |
NewerOlder