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 (Build.VERSION.SDK_INT >= 14) { | |
Intent intent = new Intent(Intent.ACTION_INSERT) | |
.setData(Events.CONTENT_URI) | |
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()) | |
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()) | |
.putExtra(Events.TITLE, "Yoga") | |
.putExtra(Events.DESCRIPTION, "Group class") | |
.putExtra(Events.EVENT_LOCATION, "The gym") | |
.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY) | |
.putExtra(Intent.EXTRA_EMAIL, "[email protected],[email protected]"); |
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 void getClientList() { | |
int macCount = 0; | |
BufferedReader br = null; | |
try { | |
br = new BufferedReader(new FileReader("/proc/net/arp")); | |
String line; | |
while ((line = br.readLine()) != null) { | |
String[] splitted = line.split(" +"); |
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
################# | |
## Eclipse | |
################# | |
*.pydevproject | |
.project | |
.metadata | |
bin/ | |
tmp/ | |
*.tmp |
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
/** | |
* This method converts dp unit to equivalent pixels, depending on device density. | |
* | |
* @param dp A value in dp (density independent pixels) unit. Which we need to convert into pixels | |
* @param context Context to get resources and device specific display metrics | |
* @return A float value to represent px equivalent to dp depending on device density | |
*/ | |
public static float convertDpToPixel(float dp, Context context){ | |
Resources resources = context.getResources(); | |
DisplayMetrics metrics = resources.getDisplayMetrics(); |
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 final String ANDROID_RESOURCE = "android.resource://"; | |
public static final String FORESLASH = "/"; | |
public static Uri resIdToUri(Context context, int resId) { | |
return Uri.parse(Consts.ANDROID_RESOURCE + context.getPackageName() | |
+ Consts.FORESLASH + resId); | |
} | |
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 class URLUtils { | |
private static final String fGOOGLE_DOC_URL = "http://docs.google.com/gview?embedded=true&url=%s"; | |
private enum GoogleDocType{ | |
PDF(".pdf"), DOC(".doc"), XLS(".xls"), DOCX(".docx"), XLSX(".xlsx"); | |
private String mSuffix; | |
GoogleDocType(String suffix){ | |
mSuffix = suffix; |
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
Log.i(TAG, "userdMemory: " + Debug.getNativeHeapSize() / 1048576); |
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
//Clipboard API has changed on level 11 of Android SDK. Here is some code to handle both versions from arinkverma. | |
// get text | |
@SuppressWarnings("deprecation") | |
public void putText(String text){ | |
int sdk = android.os.Build.VERSION.SDK_INT; | |
if(sdk < android.os.Build.VERSION_CODES. HONEYCOMB) { | |
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); | |
clipboard.setText(text); |
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
// 方法 1 | |
ArrayList al = new ArrayList(); | |
// add elements to al, including duplicates | |
HashSet hs = new HashSet(); | |
hs.addAll(al); | |
al.clear(); | |
al.addAll(hs); |
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
/** | |
* Copyright 2013 Bo Wang | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
OlderNewer