`
dingran
  • 浏览: 372147 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
在Dialog.java类中,有几行代码是关乎UI线程的操作的,拿出来研究一下,呵呵   private final Thread mUiThread ; private final Handler mHandler = new Handler();// 只在下面用了一次而已 private final Runnable mDismissAction = new Runnable() {         public void run() {             dismissDialog();         }     };   /**  * Dismis ...
这个函数是从Dialog.java里找到的: /** * @return The activity associated with this dialog, or null if there is no assocaited activity. */ private ComponentName getAssociatedActivity() { Activity activity = mOwnerActivity; Context context = getContext(); while (activit ...
接收器里的代码: public class StartReceiver extends BroadcastReceiver { private String TAG = "receiver.StartReceiver"; static final String ACTION = "android.intent.action.BOOT_COMPLETED"; @Override public void onReceive(Context context, Intent intent) { if(intent.ge ...
private int DIALOG_ALERT_DISMISS = 0;         private Handler mhandler = new Handler() {         public void handleMessage(Message msg) {             switch (msg.what) {             case DIALOG_ALERT_DISMISS:                 alertDialog.dismiss();                                 break;     ...
现在的函数输入字符串的格式是:yyyy-MM-dd 例如:2011-01-22 输出是字符串:星期六   /**      * James larsson method.Caculate week from date.      * @param date fromat:yyyy-MM-dd      * @return      */     private String CaculateWeekDay(String date)     {                 String dateYear = date.substring(0, 4);        ...
ListView也好,GridView也罢,都是AdapterView,呵呵,都的用各种各样的Adapter。    而且还必须得用Adapter,否则addView和和removeView是会报异常滴。   那么Adapter有什么优缺点呢,优点我就不废话了,只一样,通过优化getView方法可以提高显示速度,对于大数据量来说就   很有优势了,但是缺点也出来了,那就是这种相当于数据缓存复用的方式会带来显示的数据会出现重复或者操作的对象重复的   现象,那么具体来说吧。   public View getView(int position, View convertView ...
通常ListView的条目之间会有一条渐隐的横线,有时候我没并不需要,怎么把它消失掉呢,那么把间距设为0是个最直接的办法,ListView里也提供了这个方法:   在xml中这样设置:android:dividerHeight="0px", 什么,不起作用,那换个单位试试,唉,还是不行! 那我们从代码里设置吧:list.setDividerHeight(0); 恩,这样就可以了!   说明了,谷歌也有打盹的时候啊,这东西,对于搞UI来说,还是都试试吧。。。
这个东西用于通信还是比较方便的,呵呵,那就来个最简洁的吧:   发送端,即Broadcast:   private String BROADCAST_ACTION_SEARCH_PROCESS = "dingran.SearchProcess";   Intent intent = new Intent(); intent.setAction(BROADCAST_ACTION_SEARCH_PROCESS); // 把需要传递的数据放到intent里 this.sendBroadcast(intent);   接收端,即BroadcastReceiver ...
获取当前按下的按键键值,直接新建工程,把这段代码放到主Activity里就行了。   /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); LinearLayout ll = new LinearLa ...
直接新建个工程,放到主Activity的onCreate方法中即可。   /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); LinearLayout ll = new LinearLayout(t ...
桌面图标魔术师,可以给应用程序生成快捷方式图标,自定义图标的名字和图片,删除指定的快捷方式图标,清空桌面等功能。后续版本还在不断升级中。 此程序需要安装辅助程序,Buuf_Icon_Pack_v1.1.apk, FroisIcons_v1.0.apk,android20icons_v1.0.apk,Heroes_Icon_Pack_v1.0.apk   希望大家多多点击里面的广告,嘿嘿   关于本程序的源码,请关注博客,已经发布了一篇帖子,以后会陆续发布...
通过分析Launcher的生成快捷方式的过程,找出了使用Intent发送请求,Launcher通过自己注册的InstallShortCutReceiver和UnInstallShortCutReceiver实现了快捷方式图标的生成与移除过程。本文主要分析外部apk如何使用Intent请求生成快捷方式和移除快捷方式图标的问题。   生成快捷方式代码:   private static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT"; ...
Spinner是个很棒的控件,呵呵,鄙人有感于Dialog的图文混排,特意在Spinner上试试,结果效果还不错呵呵: 选中后的效果: 具体实现过程和资源都在附件的工程里,分享出来大家一起研究吧,呵呵
Global site tag (gtag.js) - Google Analytics