System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| // 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); |
| import 'dart:convert'; | |
| import 'package:logger/logger.dart'; | |
| class PrettyLogPrinter extends LogPrinter { | |
| static final levelColors = { | |
| Level.verbose: AnsiColor.fg(AnsiColor.grey(0.5)), | |
| Level.debug: AnsiColor.none(), | |
| Level.info: AnsiColor.fg(12), | |
| Level.warning: AnsiColor.fg(208), |
| public class MainActivity extends Activity { | |
| private static final String TAG = MainActivity.class.getSimpleName(); | |
| private final MainActivity self = this; | |
| MainService mService; | |
| MyServiceConnection mConn; | |
| boolean mIsBound; | |
| @Override | |
| public void onCreate(Bundle savedInstanceState) { |
| // --------------------------------------------------- | |
| // Get the color and more attributes from the theme. | |
| // --------------------------------------------------- | |
| TypedArray ta = context.getTheme().obtainStyledAttributes(R.styleable.ViewStyle); | |
| int labelColor = ta.getColor(R.styleable.ViewStyle_labelColor, defValue); | |
| int dividerColor = ta.getColor(R.styleable.ViewStyle_dividerColor, defValue); | |
| float textSize = ta.getDimension(R.styleable.ViewStyle_textSize, defValue); |
| <Button | |
| android:id="@+id/button1" | |
| style="@style/GlossyGradientButtonStyle" | |
| android:layout_width="wrap_content" | |
| android:layout_height="@dimen/button_height" | |
| android:minWidth="100dp" | |
| android:text="OK" /> | |
| <Button | |
| android:id="@+id/button2" |
| class DateTimeSerializer { | |
| static DateTime? deserialize(String? serialized) { | |
| if (serialized == null) return null; | |
| final serializedString = serialized; | |
| final fixed = serializedString.replaceAllMapped( | |
| RegExp(r'(.*:\d\d)(\.\d+)?(Z|[+-]\d{2}:\d{2})'), | |
| (match) { | |
| // #1 capturing group is date and time without a fraction of a second |
| /** | |
| * A generic class that holds a value with its loading status. | |
| * @param <T> | |
| */ | |
| // ImmutableClass | |
| class Resource<T> private constructor( | |
| val status: Status, | |
| val data: T? = null, | |
| val throwable: Throwable? = null, | |
| val id: Long = 0 |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script> | |
| window.MediaSource = window.MediaSource || window.WebKitMediaSource; | |
| function testTypes(types) { | |
| for (var i = 0; i < types.length; ++i) | |
| console.log("MediaSource.isTypeSupported(" + types[i] + ") : " + MediaSource.isTypeSupported(types[i])); | |
| } |
| public class SignalStrengthListener extends PhoneStateListener { | |
| @Override | |
| public void onSignalStrengthsChanged(SignalStrength signalStrength) { | |
| super.onSignalStrengthsChanged(signalStrength); | |
| boolean isGsm = signalStrength.isGsm(); | |
| // Get the CDMA RSSI value in dBm | |
| int iCdmaDbm = signalStrength.getCdmaDbm(); | |
| // Get the CDMA Ec/Io value in dB*10 |