Skip to content

Instantly share code, notes, and snippets.

@granoeste
granoeste / AndroidManifest_auto.xml
Created September 19, 2011 09:00
[Android] Definition of InstallLocation in AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.granoeste.creador.InternalOnlyAppWidget"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto"
>
</manifest>
@granoeste
granoeste / GoogleServiceAuthExampleActivity.java
Created September 28, 2011 12:53
[Android] Google Service Authenticate
public class GoogleServiceAuthExampleActivity extends ListActivity {
private static final String TAG = GoogleServiceAuthExampleActivity.class.getName();
GoogleServiceAuthenticator authenticator;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
authenticator = new GoogleServiceAuthenticator(this);
Account[] accounts = authenticator.getGoogleAccounts();
@granoeste
granoeste / list_row.xml
Created October 6, 2011 04:12
[Android] ListView Layout
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/list_row_background"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
@granoeste
granoeste / gist:1716840
Created February 1, 2012 12:40
[Android] Is this application system? Or whether the system is not.
final PackageManager pm = getPackageManager();
final List<ApplicationInfo> appInfos = pm.getInstalledApplications(Context.BIND_AUTO_CREATE);
for (final ApplicationInfo appInfo : appInfos) {
// Determination of the bit flag.
if( (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
Log.d("ApplicationInfo[SYSTEM]",appInfo.toString());
} else {
Log.d("ApplicationInfo[NOT SYSTEM]",appInfo.toString());
@granoeste
granoeste / gist:1842596
Created February 16, 2012 06:15
[Android]IOException: No space left on device when commit in SharedPreferences
Exception occurs when lack of capacity when you commit in SharedPreferences
---
02-16 15:10:15.378: W/ApplicationContext(2289): writeToFile: Got exception:
02-16 15:10:15.378: W/ApplicationContext(2289): java.io.IOException: No space left on device
02-16 15:10:15.378: W/ApplicationContext(2289): at org.apache.harmony.luni.platform.OSFileSystem.write(Native Method)
02-16 15:10:15.378: W/ApplicationContext(2289): at dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171)
02-16 15:10:15.378: W/ApplicationContext(2289): at java.io.FileOutputStream.write(FileOutputStream.java:300)
02-16 15:10:15.378: W/ApplicationContext(2289): at com.android.internal.util.FastXmlSerializer.flushBytes(FastXmlSerializer.java:212)
02-16 15:10:15.378: W/ApplicationContext(2289): at com.android.internal.util.FastXmlSerializer.flush(FastXmlSerializer.java:233)
02-16 15:10:15.378: W/ApplicationContext(2289): at com.android.internal.util.FastXmlSerializer.endDocument(FastXmlSerializer.java:183)
package net.vvakame.delegatefactory.sample.hide;
/* @hide */
public class Bridge {
public Bridge() {
}
/* @hide */
static Data2 combine(Data1 data) {
@granoeste
granoeste / layout.xml
Created April 27, 2012 05:33
[Android][style] View with Style
<TextView
style="@style/LabelText"
android:text="@string/name" />
@granoeste
granoeste / cont.java
Created May 1, 2012 10:30
[Android]Accessing Internal Resources
Map<String, Integer> mapResources = new HashMap<String, Integer>();
static final String defType = "drawable";
static final String defPackage = "android";
static final String [] names = {
"ic_menu_account_list",
"ic_menu_add",
"ic_menu_agenda",
"ic_menu_allfriends",
@granoeste
granoeste / layout.xml
Created May 17, 2012 05:00
[Android] Refer to the System Resource
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@granoeste
granoeste / Activity.java
Created May 25, 2012 13:07
[Android] no animations when Activity started.
Intent intent = new Intent(this,MyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);