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
public static <T> void recursiveSearchAndDeleteDuplicate(List<T> source, List<T> target) { | |
T str = source.get(0); | |
Iterator<T> it = source.iterator(); | |
while (it.hasNext()) { | |
T e = it.next(); | |
if (str.equals(e)) { | |
it.remove(); | |
} | |
} |
public class FacebookLoginActivity extends Activity { | |
private Button mLoginButton; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_facebook_login); | |
mLoginButton = findViewById(R.id.login_button); | |
mLoginButton.setOnClickListener(new View.OnClickListener() { |
public class MyActivity extends Activity { | |
protected Handler mInternalHandler; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
mInternalHandler = new InternalHandler(this); | |
} |
<!-- | |
xmlns:tools="http://schemas.android.com/tools" for Graphical Layout View. | |
--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" |
// makeLogTag | |
${:importStatic(net.granoeste.commons.util.LogUtils.makeLogTag)}private static final String TAG = makeLogTag(${enclosing_type}.class); | |
// TRACE | |
${:importStatic(net.granoeste.commons.util.LogUtils.LOGV)}LOGV(TAG, "${enclosing_method}()" | |
// LOGV | |
${:importStatic(net.granoeste.commons.util.LogUtils.LOGV)}LOGV(TAG, ${cursor}); | |
// LOGD |
boolean isLauncher = intent.hasCategory(Intent.CATEGORY_LAUNCHER); | |
if (!isLauncher) { | |
Intent intent = new Intent(context, TopActivity.class); | |
intent.setAction(Intent.ACTION_MAIN); | |
intent.addCategory(Intent.CATEGORY_LAUNCHER); | |
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | |
| Intent.FLAG_ACTIVITY_NEW_TASK |
public String getLocalIpAddress() { | |
try { | |
for (Enumeration<NetworkInterface> en = NetworkInterface | |
.getNetworkInterfaces(); en.hasMoreElements();) { | |
NetworkInterface intf = en.nextElement(); | |
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { | |
InetAddress inetAddress = enumIpAddr.nextElement(); | |
if (!inetAddress.isLoopbackAddress()) { | |
return inetAddress.getHostAddress().toString(); | |
} |
// To implement state saving and restoration in the custom view... | |
// | |
// You should implement the SavedState extend the BaseSavedState. | |
// You should be implemented to override the onSaveInstanceState and onRestoreInstanceState. | |
// TextView will be helpful. | |
// TextView | |
public class TextView extends View implements ViewTreeObserver.OnPreDrawListener { | |
/** |
<!-- Default text typeface. --> | |
<attr name="typeface"> | |
<enum name="normal" value="0" /> | |
<enum name="sans" value="1" /> | |
<enum name="serif" value="2" /> | |
<enum name="monospace" value="3" /> | |
</attr> | |
<!-- Default text typeface style. --> | |
<attr name="textStyle"> |