Forked from: Cesar Díez (https://github.com/cesards)
* In titles means it has been categorized more than once (in different categories)
InputStream stream = mActivity.getResources().openRawResource(R.raw.file_name); |
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)
(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.
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); | |
} |
VideoView videoView =(VideoView) findViewById(R.id.videoViewId); | |
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"/yourvideo"); | |
videoView.setVideoURI(uri); | |
videoView.start(); |
String videourl = "http://something.com/blah.mp4"; | |
Uri uri = Uri.parse(videourl); | |
Intent intent = new Intent(Intent.ACTION_VIEW, uri); | |
intent.setDataAndType(uri, "video/mp4"); | |
startActivity(intent); |
videoView = (VideoView)findViewById(R.id.VideoView); | |
videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); | |
videoView.start(); |