qa962839575的博客
qa962839575 · 共 43 篇文章
android之隐示意图--在一个 <intent-filter>意图中用两个category启动这个activity
主页面布局:layout/activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="…
2014-12-06 19:17 · android · 评论(0)
14章类型信息-之类型转换前先做检查--之使用类字面常量--类名.class--以及动态instanceof(isInstance方法)----递归计数(计算各个类的个数)
实例代码: 实体类父类: //: typeinfo/pets/Individual.java package typeinfo.pets; public class Individual implements Comparable<Individual> { private static long counter = 0; private final long id = counter++; private String name; public Individual(String name) { this.name = name; } // 'name' is optional: publ…
2014-12-04 14:28 · java编程思想 · 评论(0)
14章类型信息-之类型转换前先做检查--之instanceof
instanceof用法: 对于instanceof有比较严格的限制,只可将其与命名类型进行比较,而不能与class对象做比较。 理解:这里所说的就是像if(pet instanceof Mutt) counter.count("Mutt");这里的Mutt,不能用对象比较,只能用类名,比如(Mutt mutt = new Mutt()然后用mutt)或者 Mutt.class就不行了, 实例代码: 实体类父类: //: typeinfo/pets/Individual.java package typeinfo.pets; public class Individual implement…
2014-12-04 13:19 · java编程思想 · 评论(0)
线程通信之looper之用法--主线程和工作线程
说明:(之前只用handle是因为主线程默认就加上Looper.prepare()和Looper.loop()的。所以主线程可以通过handle收发信息,但是如果在thread里面的话,就是工作线程,工作线程的话,默认是没有加上那两段代码的,所以要手动加上,然后再通过handle.sendMessage()发送信息到工作线程才能取到信息) 主显示布局以及代码: activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schem…
2014-12-03 21:47 · android · 评论(0)
线程通信之handle用法
主显示布局以及代码: activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/btDownload" android…
2014-12-03 14:23 · android · 评论(0)
android之listView之增删改查
主显示布局以及代码: activity_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/lvGenerals" android:layout_width="match_parent…
2014-12-02 22:24 · android · 评论(0)
android之listView缓存机制
activity_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/a…
2014-12-01 14:05 · android · 评论(0)
andriod之对话框--标准对话框、列表对话框、自定义对话框
activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/btnStandardDialog" android:layout_width="match_parent" android:layout_height=…
2014-11-30 23:32 · android · 评论(0)
android之GridView和Gallery
GridView: /activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <GridView android:id="@+id/gvGenerals" android:layout_width="match_parent"…
2014-11-30 23:11 · android · 评论(0)
android之ArrayAdaper之Spinner
listView页面布局:layout/activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TableLayout android:layout_width="…
2014-11-30 10:26 · android · 评论(0)
android之ArrayAdaper应用
listView页面布局:layout/activity_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:p…
2014-11-30 10:18 · android · 评论(0)
android之simpleAdaper应用
listView页面布局:layout/activity_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:p…
2014-11-30 09:40 · android · 评论(0)
android之ListView和adapter配合显示图片和文字列表
listView页面布局:layout/activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <ListView android:id="@+id/lvGen…
2014-11-29 13:00 · android · 评论(0)
android之启动桌面activity
主页面布局:layout\activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/btnHome" android:layout_width="wrap_content" android:layout_heigh…
2014-11-27 21:04 · android · 评论(0)
android之隐示意图--在一个 <intent-filter>意图中用两个action启动这个activity
主页面布局:layout/activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="…
2014-11-27 17:03 · android · 评论(0)