Skip to content

Instantly share code, notes, and snippets.

View searover's full-sized avatar
💭
I may be slow to respond.

Edmund Lu searover

💭
I may be slow to respond.
View GitHub Profile
@searover
searover / TypeArrayUsage.java
Created April 12, 2015 10:40
A TypeArray usage
TypedArray array = context.getTheme().obtainStyledAttributes(attrs,
R.styleable.PieChart,0,0);
try {
mShowText = array.getBoolean(R.styleable.PieChart_showText,false);
mTextPos = array.getInteger(R.styleable.PieChart_labelPosition,0);
}finally {
array.recycle();
}
@searover
searover / Utils.java
Last active August 29, 2015 14:18
android code for checking is online
public boolean isOnline() {
ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null && networkInfo.isConnected());
}
@searover
searover / CustomTitleView.java
Last active August 29, 2015 14:18
android-snippets
/**
* Created by searover on 3/29/15.
*/
public class CustomTitleView extends View {
/**
* 文本
*/
private String mTitleText;