http://www.ideasandroid.com/
http://www.oschina.net/code/list
http://www.cnbeta.com/
http://www.byywee.com/List.aspx?classid=10071
http://stackoverflow.com/
http://code.google.com/p/danbooru-gallery-android/
http://www.android123.com.cn/
http://android.tgbus.com/Android/tutorial/Index.shtml
http://labs.chinamobile.com/mblog/103798_27363
1、设置窗口格局为半透明
getWindow().setFormat(PixelFormat.TRANSLUCENT);
2、Android中在非UI线程里更新View的不合办法:
* Activity.runOnUiThread( Runnable )
* View.post( Runnable )
* View.postDelayed( Runnable, long )
* Hanlder
3、全屏显示窗口
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
4、取得屏幕大小
办法A:
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
hAndW[0] = display.getWidth();
hAndW[1] = display.getHeight();
办法B:
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
hAndW[0] = dm.widthPixels;
hAndW[1] = dm.heightPixels;
5、调浏览器 载入网址
Uri uri = Uri.parse("http://www.google.com");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
6、取得内存大小
ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(outInfo);
//可用内存
outInfo.availMem
//是否在低内存状况
outInfo.lowMemory
取得ScrollView的实际高度
scrollview.getHeight()
scrollview.getMeasuredHeight()
scrollview.compute()
scrollview.getLayoutParams().height
7、监听App安装/卸载事务
A.Define a class derived class BroadcastReceiver;
B.Register broadcast receiver;
MyBroadcastReceiver myReceiver = new MyBroadcastReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_INSTALL);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
...
filter.addDataScheme("package"); //This line is very important. Otherwise, broadcast can""t be received.
registerReceiver(myReceiver, filter);
Notes: The package name is Intent.mData. Intent.mData is not available in SDK 1.0, but it can be retrieved by calling Intent.getDataString();
8、取得IP地址
A.
//Connect via WIFI 经由过程wifi
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int ipAddress = wifiInfo.getIpAddress();
B.
//Connect via GPRS经由过程gprs
public String getLocalIpAddress(){
try{
for(Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();){
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();){
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()){
return inetAddress.getHostAddress().toString();
}
}
}
}catch (SocketException ex){
Log.e(S.TAG, ex.toString());
}
return null;
}
9、ListView 后面adapter数据已更改,然则ListView没有收到Notification
起首,必须将 更新adapter数据的代码放在:Handler.post(Runnable)办法中履行;
然后,若是Adapter数据的起原若是是cursor(CursorAdapter)的话 可以cursor.requery一下,若是是此外可以强迫调用一下notifyChange, notifyChange 会调用 invalidate 进行重绘;
10、模仿HOME键
Intent i=new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
11、设置核心
editText.setFocusable(true);
editText.requestFocus();
editText.setFocusableInTouchMode(true);
说到Android开发,不免想到下载 Java jdk,Android SDK,eclipse,配置环境等等,今天主要是说说基于Rexsee的开发入门:Hello world。相对于刚刚提到的原生开发,Rexsee确实简单太多.
准备工作配置环境
1.首先安装 Java JDK吧 地址:http://www.java.com/zh_CN/
2.其次安装Rexsee模拟器把,下载:这个只有114M,里面模拟的是Android 2.2,下载:
http://www.rexsee.com/rexsee/RexseeEmulator.rar后面讲的模拟器就是这个,当然也可以使用官方下载 Android SDK。
3.解压模拟器之前装好Java jdk,配置环境变量。
4.解压模拟器,比如到C盘下C:\RexseeEmulator,这时候模拟器打开会出现找不到sdk,不要急,打开环境变量,添加Android_SDK_HOME="C:\RexseeEmulator";OK现在可以用了。
5.下载Rexsee,安装到模拟器,不会的看install命令吧。
下载地址:http://www.rexsee.com/rexsee/rexseeDeveloper-release.apk
6.需要的再安装一个手机API手册,除了可以看到API还有实例运行哦。下载地址:
http://www.rexsee.com/rexsee/rexseeReference.apk
7.配置一个电脑端的服务器,笔者使用的是apache+mysql的php服务器,配置过程省去。
开发设置篇
1.在这之前,用命令ipconfig/all得到本机iP。后面用。
2.打开模拟器开发端的Rexsee。设置如下:
首页地址:http://192.168.0.111:80/a/index.php(这里iP就是本机ip,a/index.php就是我的网站目录下面子目录a的首页文件)
URL/IP:http://192.168.0.111
port:80
path:a/index.php
提交重启,就会定位到服务器首页来了.