当前位置: 编程技术>移动开发
本页文章导读:
▪JDK6新特性,JAVA取得机器MAC地址的方法 JDK6新特性,JAVA获得机器MAC地址的方法
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.NetworkInterface;
import java.util.Enumeration;
/**
* JDK6新特性,JAVA获得机器MAC地址的方法
*
* @au.........
▪ 怎么从SIM卡下读取联系人信息 如何从SIM卡上读取联系人信息
如何从sim卡上读取联系人信息?找了好半天没有什么好办法
1 楼
glacier3
2009-11-11
Get the base URI for contacts.
ContentURI myPerson = new ContentURI(and.........
▪ Google Latitude(谷歌纵横)——Google全面进兵SNS市场 Google Latitude(谷歌纵横)——Google全面进军SNS市场
Google Latitude(谷歌纵横)——Google全面进军SNS市场
Mobile2.0 2009年02月5日 星期四 23:15
ShareThis
(No Ratings Yet)
近日,Google推出了Google Latitude(.........
[1]JDK6新特性,JAVA取得机器MAC地址的方法
来源: 互联网 发布时间: 2014-02-18
JDK6新特性,JAVA获得机器MAC地址的方法
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.NetworkInterface;
import java.util.Enumeration;
/**
* JDK6新特性,JAVA获得机器MAC地址的方法
*
* @author 老紫竹(Java世纪网,java2000.net)
*/
public class Test {
// 返回一个字节的十六进制字符串
static String hexByte(byte b) {
String s = "000000" + Integer.toHexString(b);
return s.substring(s.length() - 2);
}
public static void main(String[] args) throws Exception {
System.out.println("本机器的所有的网卡MAC发下:");
getMacOnWindow();
getMac();
}
/**
* JDK1.6新特性获取网卡MAC地址
*/
public static void getMac() {
try {
Enumeration<NetworkInterface> el = NetworkInterface.getNetworkInterfaces();
while (el.hasMoreElements()) {
byte[] mac = el.nextElement().getHardwareAddress();
if (mac == null)
continue;
StringBuilder builder = new StringBuilder();
for (byte b : mac) {
builder.append(hexByte(b));
builder.append("-");
}
builder.deleteCharAt(builder.length() - 1);
System.out.println(builder);
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* 原始的获取网卡MAC地址
*/
public static void getMacOnWindow() {
try {
String mac = null;
Process process = Runtime.getRuntime().exec("ipconfig /all");
BufferedReader buffer = new BufferedReader(new InputStreamReader(process.getInputStream()));
for (String line = buffer.readLine(); line != null; line = buffer.readLine()) {
int index = line.indexOf("Physical Address");
if (index <= 0) {
continue;
}
mac = line.substring(index + 36);
break;
}
buffer.close();
process.waitFor();
System.out.println(mac);
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
这个代码包含了以前常见的用Runtime实现的方法,已经使用JDK1.6新特性实现的方法。
[2] 怎么从SIM卡下读取联系人信息
来源: 互联网 发布时间: 2014-02-18
如何从SIM卡上读取联系人信息
如何从sim卡上读取联系人信息?找了好半天没有什么好办法
如何从sim卡上读取联系人信息?找了好半天没有什么好办法
1 楼
glacier3
2009-11-11
Get the base URI for contacts.
ContentURI myPerson = new ContentURI(android.provider.Contacts.People.CONTENT_URI.toURI());
2 楼
mgssnake
2009-11-12
之前也见过这样的问题,但是没人回答,也非常想知道
glacier3的代码是几版本的
我用1.5没有你说的这个类
glacier3的代码是几版本的
我用1.5没有你说的这个类
3 楼
fuchao01
2009-11-12
我也试了下,没有ContentURI 这个类,而且Contacts.People这个方法过时了,CONTENT_URI也没有toURI()这个方法
[3] Google Latitude(谷歌纵横)——Google全面进兵SNS市场
来源: 互联网 发布时间: 2014-02-18
Google Latitude(谷歌纵横)——Google全面进军SNS市场
ShareThis
共享自己的位置,可以选择当前位置,也可以固定一个位置,也可以不共享
更改自己的个性签名
获取好友的位置(包括该位置的更新时间为多久前)
获取好友的个性签名
获取好友的手机联系方式(如果对方共享了),可以直接发短信
Get direction to your friend
夫妻间互相照应,也互相监督(Joke)。根据博弈论,双方都老实比双方都不老实好。
朋友碰头,可以知道对方到哪里了,不需要用传统方式通知对方了。
要到朋友那里,不知道怎么走,Get direction to your friend,就可以了
想和朋友去某给对方玩,朋友不认识路,你认识。你手动选择一个位置,告诉对方,对方直接走,或者Get direction。
Read more: http://www.xiaxiaoyang.com/archives/37813/#ixzz0ZBCG8Ioj
Google Latitude(谷歌纵横)——Google全面进军SNS市场
Mobile2.0 2009年02月5日 星期四 23:15
ShareThis
(No Ratings Yet)
近日,Google推出了Google Latitude(谷歌纵横),基于Google Map手机版的SNS,能够让好友们(主要是Google好友)互相看到对方在哪里。Google的定位系统不仅仅可以通过GPS,还能通过基站,因此,Google Latitude增加了好友间的互动。
目前来看,Google Latitude有如下功能:
个人认为,Google Latitude可以这样玩:
欢迎大家补充。
Friendfeed Room地址:http://friendfeed.com/rooms/zongheng
#updated:在电脑上如何访问?http://www.google.com/latitude,然后进入iGoogle,再到Google首页,语言设置为英文,就可以了。
Read more: http://www.xiaxiaoyang.com/archives/37813/#ixzz0ZBCG8Ioj
1 楼
123760484lc
2010-11-20
写的不错,,有机会可以交流下
最新技术文章: