This a my first gist note.
printf("Hello world.")
This a my first gist note.
printf("Hello world.")
public class SDcardService extends Service { | |
@Override | |
public IBinder onBind(Intent intent) { | |
// Return the communication channel to the service. | |
throw new UnsupportedOperationException("Not yet implemented"); | |
} | |
@Override | |
public void onCreate() { | |
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED); |
# Built application files | |
/*/build/ | |
# Crashlytics configuations | |
com_crashlytics_export_strings.xml | |
# Local configuration file (sdk path, etc) | |
local.properties | |
# Gradle generated files |
/* | |
* Copyright (C) 2006 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
<android.support.v7.widget.Toolbar | |
xmlns:app="schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/primaryColor" | |
android:contentInsetLeft="0dp" | |
android:contentInsetStart="0dp" | |
app:contentInsetLeft="0dp" | |
app:contentInsetStart="0dp" | |
android:contentInsetRight="0dp" |
<!--Refer to: http://stackoverflow.com/questions/20862258/android-how-to-get-appcompat-translucent-type-theme-with-support-actionbar--> | |
<!-- /res/values/styles.xml --> | |
<style name="Theme.AppCompat.Translucent"> | |
<item name="android:windowNoTitle">true</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:colorBackgroundCacheHint">@null</item> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowAnimationStyle">@android:style/Animation</item> | |
</style> |
import android.app.AlertDialog; | |
// Refer to: http://stackoverflow.com/questions/1979369/android-activity-as-a-dialog | |
public class DialogThemeActivity extends Activity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
new AlertDialog.Builder(this) | |
.setTitle("title") |
/** | |
* Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and | |
* the specified value (exclusive), drawn from this random number generator's sequence. | |
* 返回一个在 [0, n-1] 之间均匀分布的伪随机数. | |
* | |
* @return [0, n-1] | |
*/ | |
int nextInt(int n); |
<!-- http://stackoverflow.com/questions/30674648/android-design-support-tablayout-overlapping-content --> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/main_content" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.design.widget.AppBarLayout | |
android:id="@+id/appbar" |
/** | |
* Method #0:操作符(或者说关键字)instanceof | |
* object 是 C 的实例吗? | |
*/ | |
if (object instanceof C) | |
; | |
/** | |
* Method #1: isInstance(Object object) | |
* Tests whether the given object can be cast to the class represented by this Class. |