摘要:
public class MyView extends View {private int textX = 20,textY = 20;public MyView(Context context) {super(context);setFocusable(true);}@Overrideprotected void onDraw(Canvas canvas) {//创建一个画笔实例Paint paint = new Paint();paint.setColor(Color.RED);//绘制文本canvas.drawText("Game", textX, textY, pa 阅读全文
摘要:
public class UpdateService extends Service { private int count =0 ; private ProgressBar bar; private Button btnC; private RemoteViews rv; Notification notification; NotificationManager mManager; /* 下载保存路径 */ private String mSavePath; /* 保存解析的XML信息 */ HashMap mHashMap; ... 阅读全文
摘要:
现在需要在一个独立于进程的Service中做一些操作, 同时要能在外部调用这个服务做一些事情.使用bindService调用没有问题,问题是Activity或者App结束后Service也就结束了.列一下规则:操作a----退出-----服务运行否1,bind: no2,bind--unbind: no3,start: yes4,start--bind: yes5,start--bind--unbind: yesActivity想控制Service,还是必须使用bind,所以先start,再bind,既能保证其生命周期,又能进行调用... 阅读全文
摘要:
final ActivityManager manager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);for (ActivityManager.RunningServiceInfo service11:manager.getRunningServices(Integer.MAX_VALUE)) {Log.v("xxxxxxxxx",BindService.class.getName()+"****"+service11.service.getClassName());if 阅读全文
摘要:
原文链接http://stackoverflow.com/questions/2272378/android-using-method-from-a-service-in-an-activity(关于IBinder:官方说Base interface for a remotable object, the core part of a lightweight remote procedure call mechanism designed for high performance when performing in-process and cross-process calls.)There 阅读全文
摘要:
********************************一般来说有创建自己的Service有两种方法, 继承Service或者IntentServiceTraditionally, there are two classes you can extend to create a started service:ServiceThis is the base class for all services. When you extend this class, it's important that you create a new thread in which to do a 阅读全文
摘要:
public int getId(String str){ Class cls = R.drawable.class; int value = 0; try { value = cls.getDeclaredField(str).getInt(null); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFi... 阅读全文
摘要:
1,JDBC:一种可执行SQL语句的api2,MySQL没有图形化界面,如SQLServer和MySQL Front3,关系形数据库简单说就是表的集合. 面向对象形如SQL Server2005 和Oracle 10g还未大规模应用4,SQL : Structured Quary Language5,查询语句分4类: one:select two:Data Manipulation Language---insert,update,delete three:Data Definition Language----create,alter,drop,truncate four:Data... 阅读全文
摘要:
可将json文件放在assets文件夹下面,用如下方法读取/** * add by linsen * * @return the callback json string */ public void getJSONData() { // json读取 new Thread(){ public void run(){ InputStream fis = null; BufferedReader br = null; ... 阅读全文
摘要:
【1】3.0以下版本,不支持setalpha, 且不支持在xml文件中设置android:alpha = "0.5"这种方法(如果xml中设置则一律是不透明的);【2】3.0以下版本, 在xml中配置透明度,只能通过ARGB设置.,如background="#0123"【3】3.0以下版本通过以下2种方式:a:view.getBackground().setAlpha(255)这种方法设置; b:通过这种方法设置时,xml中的view的background只能设置RGB,不能是ARGB的格式 阅读全文