摘要: 引用:http://www.eoeandroid.com/thread-30515-1-1.htmlwebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { //实现下载的代码... 阅读全文
posted @ 2011-09-23 17:38 镇水古月 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_12_1259[图片]shot.jpg[代码]SplashScreen.java01publicclassSplashScreenextendsActivity {0203/**04* The thread to process splash screen events05*/06privateThread mSplashThread;0708/** Called when the activity is first created. */09@Override10publicvoidonCreate(Bundle 阅读全文
posted @ 2011-09-23 17:28 镇水古月 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_6262Android中自带的view种类很多,但是有时候不能满足我们的需求,下面介绍一种自定义view的方法,实现了拖动矩形到屏幕任意位置的需求。标签: Android SDK代码片段(5)[图片]程序截图[代码]Activity.java01packagecom.zhuozhuo;0203importandroid.app.Activity;04importandroid.os.Bundle;0506publicclassCSDNActivityextendsActivity {07/** Calle 阅读全文
posted @ 2011-09-23 17:27 镇水古月 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_163910_6093[图片]1.jpg[代码][Java]代码1requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);2setContentView(R.layout.main);3setProgressBarIndeterminateVisibility(true);---------------------------------------------------------[代码][Java]代码view sourceprint?1prote 阅读全文
posted @ 2011-09-23 17:26 镇水古月 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 引用http://www.oschina.net/code/snippet_163910_6069[文件]RecordActivity.java~5KB下载(12)view sourceprint?001packagecom.cons.dcg.collect;002003importjava.io.File;004importjava.text.SimpleDateFormat;005importjava.util.*;006importandroid.app.*;007importandroid.content.Intent;008importandroid.database.Cursor; 阅读全文
posted @ 2011-09-23 17:19 镇水古月 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_12_4121[图片]pic3.jpg[图片]pic4.jpg[代码][Java]代码01publicclassPlayerextendsAnimatedSprite {02...03@Override04protectedvoidonManagedUpdate(finalfloatpSecondsElapsed) {05super.onManagedUpdate(pSecondsElapsed);06onBeforePositionChanged();07}0809privatebooleanonBeforePos 阅读全文
posted @ 2011-09-23 17:17 镇水古月 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_4873_4437//1,已将图片保存到drawable目录下0203//通过图片id获得Drawable0405Resource res=gerResource();06Drawable drawable=res.getDrawable(id);//id为R.drawable.图片名称0708//通过图片id获得Bitmap0910Resource res=gerResource();1112Bitmap bitmap=BitmapFactory.decodeResource(res, id);1314//若只知道 阅读全文
posted @ 2011-09-23 17:08 镇水古月 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_62331privatebooleandrawall=false;02privateRefreshHandler mRedrawHandler =newRefreshHandler();03classRefreshHandlerextendsHandler {0405@Override06publicvoidhandleMessage(Message msg) {07KetrisCanvas.this.update();08KetrisCanvas.this.invalidate();09}1011pub 阅读全文
posted @ 2011-09-23 17:05 镇水古月 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_4873_6112好像是Activity里声明的Dialog。其实是两个Activity,而且甚至是两个不同的App的Activity。实现这个效果很简单。我创建了一个新的android项目。然后,给AndroidManifest文件中Activity添加了Dialog样式属性:这样,如果运行该app的时候屏幕上正显示其他应用的Activity,就会出现上图的效果。在这里Activity被伪装成Dialog了。Activity一般给人的印象是要占满全屏的。伪装成Dialog的效果是只显示在部分屏幕中。标签: Andr 阅读全文
posted @ 2011-09-23 17:01 镇水古月 阅读(302) 评论(0) 推荐(0) 编辑
摘要: JXTA 资料完善参考:http://www.oschina.net/code/snippet_149945_5616 阅读全文
posted @ 2011-09-23 16:51 镇水古月 阅读(566) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_12_698[代码]java代码01ImageView iv = (ImageView) findViewById(R.id.ImageView01);02ImageView iv2 = (ImageView) findViewById(R.id.ImageView02);03ImageView iv3 = (ImageView) findViewById(R.id.ImageView03);0405//draw的方式对整屏截取,但信息栏为黑色06View cv = getWindow().getDecorView( 阅读全文
posted @ 2011-09-23 16:46 镇水古月 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_6263 阅读全文
posted @ 2011-09-23 16:38 镇水古月 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_12_1257[图片]android_xy.gif[文件]xy_plot_4_Android_src.zip~57KB下载(127)[代码]绘制网格线的方法view sourceprint?01publicstaticvoiddraw_the_grid(Canvas this_g, Vector these_labels)02{03doublerounded_max =0.0;04doublerounded_min =0.0;05doublerounded_max_temp;06Object curElt;07Str 阅读全文
posted @ 2011-09-23 16:30 镇水古月 阅读(846) 评论(0) 推荐(0) 编辑
摘要: android:layout_gravity="top"。android:layout_gravity="bottom" 阅读全文
posted @ 2011-09-23 15:57 镇水古月 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_5221[代码]main.xmlview sourceprint?01<?xmlversion="1.0"encoding="utf-8"?>02<LinearLayoutxmlns:Android="http://schemas.android.com/apk/res/android"03Android:orientation="vertical"04Android:layout_width="f 阅读全文
posted @ 2011-09-23 15:45 镇水古月 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_5507//获取本地ip地址4748publicString getLocalIpAddress() {49try{50Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();51while(en.hasMoreElements()) {52NetworkInterface intf = en.nextElement();53Enumeration<InetAddress> enumIpA 阅读全文
posted @ 2011-09-23 15:22 镇水古月 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 引用:01//安装apk文件0203privatevoidinstallAPK(File file) {04Intent intent =newIntent(Intent.ACTION_VIEW);05Uri data = Uri.fromFile(file);06String type ="application/vnd.android.package-archive";07intent.setDataAndType(data, type);08startActivity(intent);09}10111213//卸载apk文件1415privatevoiduninsta 阅读全文
posted @ 2011-09-23 15:21 镇水古月 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 参考:http://www.cnblogs.com/salam/archive/2011/04/04/2005329.htmlhttp://www.oschina.net/code/snippet_54100_5217 阅读全文
posted @ 2011-09-23 15:19 镇水古月 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_54100_1423SurfaceView 由于可以直接从内存或者DMA等硬件接口取得图像数据,因此是个非常重要的绘图容器,网上介绍 SurfaceView的用法有很多,写法也层出不同,例如继承SurfaceView类,或者继承SurfaceHolder.Callback类等,这个可以根据功能实际需要自己选择,我这里就直接在普通的用户界面调用SurfaceHolder的lockCanvas和 unlockCanvasAndPost。对比下面的第二、三两图,三图用.lockCanvas(null),而二图用.lockC 阅读全文
posted @ 2011-09-23 15:18 镇水古月 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 引用:http://www.oschina.net/code/snippet_163910_6086[代码]AsyncImageLoader.java01packagecn.com.mzba.service;0203importjava.io.InputStream;04importjava.lang.ref.SoftReference;05importjava.net.URL;06importjava.util.HashMap;0708importandroid.graphics.drawable.Drawable;09importandroid.os.Handler;10importand 阅读全文
posted @ 2011-09-23 15:11 镇水古月 阅读(230) 评论(0) 推荐(0) 编辑