2009年11月3日
$jQuery('#createTb').children().get(0).removeChild($jQuery('#createTb').children().get(0).lastChild);
set sdk home windows ->property->android . So it is.
自带的JoinMe软件是有拨号功能
把N600连在电脑上,在手机上 选"设置"____ "应用" ____"开发"把"USB调试"打开,就能用了
在进行android-sdk-windows中进行 update all时, 报错 folder failed to be renamed or moved 2010-05-10 14:56 在进行android-sdk-windows中进行 update all时, 报错 folder failed to be renamed or moved...,goole了一下,有外国网友解决办法如下:
1, 复制 tools目录 为一个新的目录 tools-copy ,此时在android-sdk-windows 目录下有两个目录 tools 和 tools-copy
2, 在tools-copy目录运行 android.bat ,这样就可以正常 update all 了
3,之后,关闭 sdk,
4, 在 android-sdk-windows 目录运行 SDK Setup.exe, 就可以了
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DictionaryOpenHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 2;
private static final String DICTIONARY_TABLE_NAME = " user ";
private static final String DICTIONARY_TABLE_CREATE =
"CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" +
"id" + " int, " +
"name" + " TEXT);";
DictionaryOpenHelper(Context context) {
super(context, "airib_database", null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
// db.execSQL(DICTIONARY_TABLE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2)
{
}
}
package fil.ted.test;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Environment;
import android.util.Log;
public class TestDAO
{
public static String getString(Activity activity)
{
// StringBuffer strBuf = new StringBuffer(Environment.getDataDirectory().toString());
// strBuf.append("/data/data/");
// strBuf.append("fil.ted.test");
//
// strBuf.append("/databases/");
// strBuf.append("air");
// String dbPath = strBuf.toString();
// SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE);
// db.execSQL("select id from airib");
DictionaryOpenHelper mDbHelper= new DictionaryOpenHelper(activity);
SQLiteDatabase db = mDbHelper.getReadableDatabase();
String [] strr ={"id","name"};
Cursor cursor = db.query("user", strr,
null, null, null, null, null);
//return cursor.toString();
String str = "start---";
if(cursor.moveToFirst()){
do{
str = str+cursor.getString(0)+cursor.getString(1)+""t";
}while(cursor.moveToNext());
}
return str;
}
/**
* @param args
*/
public static void main(String[] args)
{
System.out.println(12);
}
}
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
public class ImageAdapter extends BaseAdapter {
//定义Context,即Activity
private Context context;
//定义整型数组 即图片源。
private Integer image[]
=
{
R.drawable.add_symbol,
R.drawable.delete_icon,
R.drawable.delete_key,
R.drawable.neato,
R.drawable.plus,
R.drawable.igoogle_logo_sm
};
public ImageAdapter(Context c) throws IllegalArgumentException, IllegalAccessException{
context=c;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
//获取图片个数。
return Integer.MAX_VALUE;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
//获取图片在库中的位置。
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
//获取图片在库中的位置。
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ImageView imageview=new ImageView(context);
//给imageView设置图片资源。
imageview.setImageResource(image[position%image.length]);
//设置比例类型。
imageview.setScaleType(ImageView.ScaleType.FIT_XY);
//设置图片布局和显示大小。
imageview.setLayoutParams(new Gallery.LayoutParams(100,100));
//设置图片之间的距离。
imageview.setPadding(15,0,15,0);
return imageview;
}
}
setContentView(R.layout.main);
// 初始化Gallery。
gallery = (Gallery) findViewById(R.id.gallery);
try
{
// 设置Gallery的Adapter。
gallery.setAdapter(new ImageAdapter(TestAndroidActivity.this));
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// 点击事件。
gallery.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView arg0, View arg1, int itemid, long arg3)
{
// TODO Auto-generated method stub
setTitle("您点击了第" + String.valueOf(itemid + 1) + "项");
}
});
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<gallery android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margintop="30dp">
</gallery>
</linearlayout>
scrollView.scrollTo(0,0);
Context context = getApplicationContext();
CharSequence text = "have a toast thank you ,you've got it!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
- Get a reference to the NotificationManager:
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
- Instantiate the Notification:
int icon = R.drawable.notification_icon;
CharSequence tickerText = "Hello";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
- Define the Notification's expanded message and Intent:
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
- Pass the Notification to the NotificationManager:
private static final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
That's it. Your user has now been notified.
发送短信相当的简单,只需要几行代码,如下:
import android.telephony.gsm.SmsManager;
import android.app.PendingIntent;
......
SmsManager sms = SmsManager.getDefault();
PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
sms.sendTextMessage(phoneNumber, null, MsgStr, pi, null);
其中参数phoneNumber和MsgStr均是String类型,表示接收方的电话号码和短信内容
接收短信相对而言麻烦一些,需要使用全局的接收类BroadcastReceiver,完整代码如下:
package com.hello.db;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.gsm.SmsMessage;
import android.widget.Toast;
public class MessageDemo extends BroadcastReceiver {
private static final String strACT = "android.provider.Telephony.SMS_RECEIVED";
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(strACT)) {
StringBuilder sb = new StringBuilder();
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus");
SmsMessage[] msg = new SmsMessage[pdus.length];
for (int i = 0; i < pdus.length; i++) {
msg[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
}
for (SmsMessage currMsg : msg) {
sb.append("From:");
sb.append(currMsg.getDisplayOriginatingAddress());
sb.append("\nMessage:");
sb.append(currMsg.getDisplayMessageBody());
}
}
Toast.makeText(context, sb.toString(), Toast.LENGTH_LONG).show();
Intent i = new Intent(context, DBDemo.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
此处的接收是收到消息时,弹出一个Toast提示,在此基础上稍做修改也可以实现将收到的消息放入文本框从而展示出来。注意最后必须将控制权交还给上一个Activity,不然程序会出错。
好了,收发短信的代码都有了,下面需要配置权限,只有程序拥有了权限,这些功能才能真正被使用
修改AndroidManifest.xml,在Activity下添加receiver节点:
<receiver android:name="MessageDemo">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
随后在application下添加节点:
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
abd shell
cd data/data
ls
cd databases
ls
sqlite2 ***.db
.table
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:XML id="xmlFile" source="menu.xml"/>
<mx:Label text="人员名单" fontSize="18" x="595" y="70"/>
<!-- 定义grid:指定数据来源,表头-->
<mx:DataGrid dataProvider="{xmlFile.order}" width="468" x="419" y="118" height="258">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="姓名" fontSize="14"/>
<mx:DataGridColumn dataField="rest" headerText="餐馆名" fontSize="14"/>
<mx:DataGridColumn dataField="food" headerText="菜名" fontSize="14"/>
<mx:DataGridColumn dataField="time" headerText="时间" fontSize="14"/>
<mx:DataGridColumn dataField="ip" headerText="IP" fontSize="14" width="115"/>
<mx:DataGridColumn dataField="price" headerText="价钱" fontSize="14"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
function selected(rtn:RadioButton):void{
Alert.show(""+rtn);
}
]]>
</mx:Script>
<mx:Button label="Check Answer"
click="Alert.show(option1.selected?'Correct Answer!':'Wrong Answer', 'Result')" x="430" y="117"/>
<mx:RadioButton groupName="year" id="option1" label="1942" value="2" x="500" y="49" click="selected(option1)" />
<mx:RadioButton groupName="year" id="option2" label="1952" value="1" x="430" y="49" click="selected(option2)"/>
</mx:Application>
|
|
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
---|
25 | 26 | 27 | 28 | 29 | 30 | 31 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 1 | 2 | 3 | 4 | 5 |
|
常用链接
留言簿
随笔档案
文章档案
相册
搜索
最新评论
阅读排行榜
评论排行榜
|
|