Forked from: Cesar Díez (https://github.com/cesards)
* In titles means it has been categorized more than once (in different categories)
public class Network { | |
public static DhcpInfo getNetworkInfo(Context context) { | |
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
android.net.NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); | |
switch (activeNetworkInfo.getType()) { | |
case ConnectivityManager.TYPE_ETHERNET: | |
return null; | |
case ConnectivityManager.TYPE_WIFI: |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Material Design Colors --> | |
<color name="md_red_50">#ffffebee</color> | |
<color name="md_red_100">#ffffcdd2</color> | |
<color name="md_red_200">#ffef9a9a</color> | |
<color name="md_red_300">#ffe57373</color> | |
<color name="md_red_400">#ffef5350</color> |
//get phone number | |
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); | |
String imei = tm.getDeviceId(); | |
String tel = tm.getLine1Number(); |
Forked from: Cesar Díez (https://github.com/cesards)
* In titles means it has been categorized more than once (in different categories)
private void launchGoogleMaps(String name, String vicinity) { | |
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, | |
Uri.parse("http://maps.google.com/maps?q="+name+","+vicinity)); | |
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); // this is the magic | |
startActivity(intent); | |
} |
(EventBus) - Android optimized event bus that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
An EventBus is a great tool for decoupling components in your application. Over the next few posts I will describe the ways that I have been using it to make my code cleaner, easier to read, and easier to test. But first, this week I want to discuss why I use an EventBus in the first place. In particular, I will compare its use to some alternative techniques.
OkHttpClient client = new OkHttpClient(); | |
Proxy proxy = new Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved("192.168.1.105", 8081); | |
client.setProxy(proxy); |
OkHttpClient okHttpClient = new OkHttpClient(); | |
okHttpClient.interceptors().add(mRefreshAndRetryInterceptor); | |
mRestAdapter = new RestAdapter.Builder() | |
... | |
.setClient(new OkClient(okHttpClient)) | |
.build(); | |
private final Interceptor mRefreshAndRetryInterceptor = new Interceptor() { |
import android.databinding.BaseObservable; | |
import android.databinding.BindingAdapter; | |
import android.databinding.BindingConversion; | |
import android.text.Editable; | |
import android.text.TextWatcher; | |
import android.widget.EditText; | |
import java.io.Serializable; |