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
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.*; | |
public class ArrayList_LinkedList { | |
public static final String filePath = "D:/MP"; | |
public static void main(String[] args) { | |
Collection collection = new ArrayList(); |
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.消费者,生产者都要实现Runnable接口 | |
//2.要有一个消费的对象,如:面包 | |
//3.模拟一个栈的操作方式,先进后出 | |
//4.线程同步,synchronized,notify,wait | |
public class AJava { |
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
/** | |
* 判断服务是否启动 | |
* | |
* @param className | |
* @return | |
*/ | |
private boolean checkServiceRunning(String className) { | |
boolean isRunning = false; | |
ActivityManager am = (ActivityManager) this | |
.getSystemService(Context.ACTIVITY_SERVICE); |
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
private void startSelfService() { | |
// 获得系统级别服务 | |
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); | |
Intent in = new Intent(this, this.getClass()); | |
PendingIntent pin = PendingIntent.getService(this, 0, in, | |
PendingIntent.FLAG_UPDATE_CURRENT); | |
// 返回系统开机到现在的时间差 | |
long timePeriod = SystemClock.elapsedRealtime(); | |
// ELAPSED_REALTIME =3s | |
am.setRepeating(AlarmManager.ELAPSED_REALTIME, timePeriod, 3 * 1000, |
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
package net.canking.myanimtest; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; |
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 boolean onTouch(View v, MotionEvent event) { | |
// TODO Auto-generated method stub | |
if (MotionEvent.ACTION_DOWN == event.getAction()) { | |
if (mCurrentDownEvent != null | |
&& mPreviousUpEvent != null | |
&& isConsiderAsDoubleTap(mCurrentDownEvent, | |
mPreviousUpEvent, event)) { | |
} | |
mCurrentDownEvent = MotionEvent.obtain(event); |
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
private final BitmapCache mMemoryCache; | |
//一般在构造函数实现 | |
mMemoryCache = new BitmapCache(); | |
private Bitmap getBitmapFromMemCache(final int key) { | |
return mMemoryCache.get(key); | |
} | |
private void addBitmapToMemoryCache(final int key, final Bitmap bitmap) { |
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
@Override | |
protected List<AppInfo> doInBackground(Void... params) { | |
// TODO Auto-generated method stub | |
List<AppInfo> list = new ArrayList<AppInfo>(); | |
// 获取系统所有的应用 | |
List<PackageInfo> appList = mContext.getPackageManager() | |
.getInstalledPackages(PackageManager.GET_META_DATA); | |
// 获取应用主activity | |
for (PackageInfo p : appList) { | |
// user app |
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 updateItemView(final int index, Object o) { | |
int visibleposition = mlist.getFirstVisiblePosition(); | |
View view = mlist.getChildAt(index - visibleposition); | |
TextView tView = (TextView) view.findViewById(R.id.item_define_word); | |
tView.setText((String) o); | |
} |
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
package com.hunt.listviewdemo; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.os.Environment; | |
import android.view.LayoutInflater; |
OlderNewer