Skip to content

Instantly share code, notes, and snippets.

@julianshen
julianshen / gist:0c85f482caac64ed26b7
Created August 20, 2014 16:33
shortcut example
Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "test");
PackageManager pm = getPackageManager();
ApplicationInfo youtube = null;
ApplicationInfo plus = null;
ApplicationInfo map = null;
try {
youtube = pm.getApplicationInfo("com.google.android.youtube", PackageScanIntentService.FLAGS_PACKAGE);
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
@julianshen
julianshen / gist:780831
Created January 15, 2011 10:49
mkobb.sh result
Creating temporary file...
mkfs.vfat 3.0.7 (24 Dec 2009)unable to get drive geometry, using default 255/63
Copying files:sending incremental file list./a1.pnga1111-0.pnga1111-1.pnga1111-10.pnga1111-11.pnga1111-12.pnga1111-2.pnga1111-3.pnga1111-4.pnga1111-5.pnga1111-6.pnga1111-7.pnga1111-8.pnga1111-9.pngaa11.pngaaa.pngabc.pngbanner.pngcallout.9.pngfoursquare_bigger.pngfslogo.pngicon.pngplurk_icon.pngplurk_icon_36.pngplurk_icon_48.pngppicon.pngseesmic_geo.pngspeak_now.pngspeak_now_popup.png
sent 5167491 bytes received 566 bytes 10336114.00 bytes/sectotal size is 5165169 speedup is 1.00
Successfully created `obbtest.obb'salt for use with obbtool is:5f88a3619e6544ef
mStorageManager = (StorageManager) getSystemService(Service.STORAGE_SERVICE);
mStorageManager.mountObb("/sdcard/obbtest.obb", "android", new OnObbStateChangeListener() {
@Override
public void onObbStateChange(String path, int state) {
Log.d("OBBTEST", ""+path+" mount:"+state);
if(state == OnObbStateChangeListener.MOUNTED) {
String mountedPath = mStorageManager.getMountedObbPath("/sdcard/obbtest.obb");
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("FRAG", "onCreateView");
return inflater.inflate(R.layout.mylayout, container);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<fragment class="com.fm.fragment1.MyFragment"
android:id="@+id/myfrag"
android:layout_width="0dp"
android:layout_weight="1"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment class="com.example.android.apis.app.TitlesFragment"
android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
/**
* Helper function to show the details of a selected item, either by
* displaying a fragment in-place in the current UI, or starting a
* whole new activity in which it is displayed.
*/
void showDetails(int index) {
mCurCheckPosition = index;
if (mDualPane) {
// We can display everything in-place with fragments.
function getcontentview() {
return R.layout('main');
}
function oncreate() {
log("MyScript", "oncreate called");
textview = findview(R.id("mytext"));
textview.setText("Hello! Javascript!");
}