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
// Create a BroadcastReceiver for ACTION_FOUND and ACTION_DISCOVERY_FINISHED | |
private final BroadcastReceiver mDeviceDiscoverReceiver = new BroadcastReceiver() { | |
int cnt = 0; | |
public void onReceive(Context context, Intent intent) { | |
String action = intent.getAction(); | |
// When discovery finds a device | |
if (BluetoothDevice.ACTION_FOUND.equals(action)) { | |
// Get the BluetoothDevice object from the Intent | |
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); |
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
// With reference to the android.app.IntentService of the Android framework | |
// Member variable | |
private volatile Looper mServiceLooper; | |
private volatile ServiceHandler mServiceHandler; | |
// Handler Class | |
private final class ServiceHandler extends Handler { | |
public ServiceHandler(Looper looper) { | |
super(looper); |
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
Intent serviceIntent = new Intent(this, MyService.class); | |
PendingIntent pendingIntent | |
= PendingIntent.getService(this, 0, serviceIntent, PendingIntent.FLAG_UPDATE_CURRENT); | |
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); | |
am.setInexactRepeating ( | |
AlarmManager.RTC, | |
System.currentTimeMillis(), | |
//AlarmManager.INTERVAL_HOUR, | |
AlarmManager.INTERVAL_FIFTEEN_MINUTES, | |
pendingIntent); |
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
public class AccountList extends ListActivity { | |
protected AccountManager accountManager; | |
protected Intent intent; | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
accountManager = AccountManager.get(getApplicationContext()); | |
Account[] accounts = accountManager.getAccountsByType("com.google"); |
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
<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> | |
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
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(); |
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
<?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"/> |
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
@Override | |
protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
int width = MeasureSpec.getSize(widthMeasureSpec); | |
int height = MeasureSpec.getSize(heightMeasureSpec); | |
} |
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
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()); |
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
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) |