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
if (android.os.Build.VERSION.SDK_INT <= 10) { //2.3版本之前使用此方法 | |
edit.setInputType(InputType.TYPE_NULL); | |
} else { //2.3版本以后用反射方法设置setSoftInputShownOnFocus(4.0)的值解决 | |
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); | |
try { | |
Class<EditText> cls = EditText.class; | |
Method setSoftInputShownOnFocus; | |
setSoftInputShownOnFocus = cls.getMethod("setSoftInputShownOnFocus", boolean.class); | |
setSoftInputShownOnFocus.setAccessible(true); | |
setSoftInputShownOnFocus.invoke(edit, false); |
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
import android.app.Service; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.os.Bundle; | |
import android.os.IBinder; | |
import android.util.Log; | |
import org.acra.ACRA; |
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
import java.io.BufferedReader; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.List; | |
/** | |
* ShellUtils | |
* <ul> | |
* <strong>Check root</strong> |
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
著作权归作者所有。 | |
商业转载请联系作者获得授权,非商业转载请注明出处。 | |
作者:Mariotaku | |
链接:https://www.zhihu.com/question/37929529/answer/74172064 | |
来源:知乎 | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.support.v4.view.MotionEventCompat; | |
import android.view.InputDevice; |
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 static class GCUtils { | |
private static final String GC_TAG = GCUtils.class.getSimpleName(); | |
public static final int GC_TRY_COUNT = 2; | |
// GC_TRY_LOOP_MAX is used for the hard limit of GC wait, | |
// GC_TRY_LOOP_MAX should be greater than GC_TRY_COUNT. | |
public static final int GC_TRY_LOOP_MAX = 5; | |
private static final long GC_INTERVAL = DateUtils.SECOND_IN_MILLIS; | |
private static GCUtils sInstance = new GCUtils(); | |
private int mGCTryCount = 0; | |
public static GCUtils getInstance() { |
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
/* Always set the map height explicitly to define the size of the div | |
* element that contains the map. */ | |
#map { | |
height: 100%; | |
} | |
/* Optional: Makes the sample page fill the window. */ | |
html, |