Star Tsai Knowledge Share
2013年12月8日 星期日
KeyGuard is deprcated,Try use WindowManager.LayoutParams.FLAG_DISSMISS_KEYGUARD
When you find references about KeyGuard or unlock keyboard on Android developer website,you may find out that "KeyguardLock class was deprecated in API level 13", it's means that this class will useless in the future.So, Try this FLAG use in WindownManager.LayoutParams when your activity on create.
Example. Alarm app on create
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
2013年11月21日 星期四
Random Select Columns in MS SQL Database
SELECT example FROM yourtable WHERE yourcondition ORDER BY NEWID()
If you just need some data ,you can try this:
SELECT Top n FROM yourtable WHERE yourcondition ORDER BY NEWID()
2013年11月11日 星期一
Share your image to other APP such like Facebook,LINE or Gmail in Unity3D with Plungin.(Android)
If you do a app that have camera function with Unity3D, you may want to share the picture
to other social Apps ,facebook or Line .Here were the roughly codes.Try it.
ADT:
private void ShareImage(string filePath) {
Intent share = new Intent(Intent.ACTION_SEND);
// Make sure you put image in the Directory
String imagePath = filePath
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
share.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(share, "Share Image!"));
}
Unity:
AndroidJavaClass player = new AndroidJavaClass( "com.unity3d.player.UnityPlayer" );
AndroidJavaObject activity = player.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject javaClass = new AndroidJavaObject( "YourBundleName", activity );
javaClass.Call("ShareImage", "FilePath");
*Note : FilePath is your file location
*Note : Your Bundle Name is like com.abc.123
2013年9月9日 星期一
訂閱:
文章 (Atom)