Skip to content

Instantly share code, notes, and snippets.

View kyungw00k's full-sized avatar
👋

Kyungwook, Park kyungw00k

👋
View GitHub Profile
@kyungw00k
kyungw00k / gist:5764413
Created June 12, 2013 11:06
[Android] Determine which activities can handle the intent
// Determine which activities can handle the intent
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
PackageManager packageManager = getContext().getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
// If there are no relevant activities, don't follow the link
boolean isIntentSafe = activities.size() > 0;
if (!isIntentSafe) {
// Something Wrong
return true;
@kyungw00k
kyungw00k / gist:5764408
Last active December 18, 2015 09:49
[Android] getPackages / getInstalledApps
class PInfo {
    private String appname = "";
    private String pname = "";
    private String versionName = "";
    private int versionCode = 0;
    private Drawable icon;
    private void prettyPrint() {
        Log.v(appname + "\t" + pname + "\t" + versionName + "\t" + versionCode);
    }
}
var fs = require('fs'),
sys = require('sys'),
http = require('http');
http.createServer(function (req, res) {
checkBalanceFile(req, res);
}).listen(8000);
function checkBalanceFile(req, res) {
fs.stat("balance", function(err) {