This file contains hidden or 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
| List<WifiConfiguration> list = wifiManager.getConfiguredNetworks(); | |
| for (WifiConfiguration i : list) { | |
| if (i.SSID != null && i.SSID.equals("\"" + ssid + "\"")) { | |
| wifiManager.disconnect(); | |
| wifiManager.enableNetwork(i.networkId, true); | |
| wifiManager.reconnect(); | |
| } | |
| } | |
This file contains hidden or 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
| func visibleBottomView(type: Type, info : MarkerInfo) { | |
| for constraint in self.bottomView.constraints as [NSLayoutConstraint] { | |
| if constraint.identifier == "bottom_height" { | |
| constraint.constant = 240 | |
| } | |
| } | |
| } | |
| func goneBottonView() { | |
| for constraint in self.bottomView.constraints as [NSLayoutConstraint] { |
This file contains hidden or 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
| TextView secondTextView = new TextView(this); | |
| Shader textShader=new LinearGradient(0, 0, 0, 20, | |
| new int[]{Color.GREEN,Color.BLUE}, | |
| new float[]{0, 1}, TileMode.CLAMP); | |
| secondTextView.getPaint().setShader(textShader); |
This file contains hidden or 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 class MainActivity extends ActionBarActivity { | |
| private int type; | |
| public static final int KEY_ONE = 1; | |
| public static final int KEY_TWO = 2; | |
| @IntDef({KEY_ONE, KEY_TWO}) | |
| public @interface KeyType{} |
This file contains hidden or 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
| Random rnd = new Random(); | |
| int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); | |
| v.setBackgroundColor(color); |
This file contains hidden or 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
| /** | |
| * Uses a combination of a PageTransformer and swapping X & Y coordinates | |
| * of touch events to create the illusion of a vertically scrolling ViewPager. | |
| * | |
| * Requires API 11+ | |
| * | |
| */ | |
| public class VerticalViewPager extends ViewPager { | |
| public VerticalViewPager(Context context) { |
This file contains hidden or 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
| private String getWifiIp() throws SocketException { | |
| for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); | |
| en.hasMoreElements(); ) { | |
| NetworkInterface intf = en.nextElement(); | |
| if (intf.isLoopback()) { | |
| continue; | |
| } | |
| if (intf.isVirtual()) { | |
| continue; | |
| } |
This file contains hidden or 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
| RestAdapter.Builder builder= new RestAdapter.Builder() | |
| .setRequestInterceptor(new RequestInterceptor() { | |
| @Override | |
| public void intercept(RequestFacade request) { | |
| request.addHeader("Accept", "application/json;versions=1"); | |
| if (MyApplicationUtils.isNetworkAvailable(context)) { | |
| int maxAge = 60; // read from cache for 1 minute | |
| request.addHeader("Cache-Control", "public, max-age=" + maxAge); | |
| } else { | |
| int maxStale = 60 * 60 * 24 * 28; // tolerate 4-weeks stale |
This file contains hidden or 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
| // 웹페이지 띄우기 | |
| Uri uri = Uri.parse("http://www.google.com"); | |
| Intent it = new Intent(Intent.ACTION_VIEW,uri); | |
| startActivity(it); | |
| // 구글맵 띄우기 | |
| Uri uri = Uri.parse("geo:38.899533,-77.036476"); | |
| Intent it = new Intent(Intent.Action_VIEW,uri); | |
| startActivity(it); |
This file contains hidden or 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
| final ObjectAnimator oa = ObjectAnimator.ofFloat(view, "x", 100f); | |
| oa.setDuration(5000); | |
| oa.start(); |
NewerOlder