解决java.io.IOException: Unable to open sync connection!方案:
关掉USB调试,然后重新开启。
首先我的系统是window7旗舰版
需要3个东西
1.visual studio 2010
我是通过在线安装的,时间比较久,大概一个上午。
可以到下面的链接下载一个名为 vs_ultimateweb.exe的东西,下载后直接安装
http://www.microsoft.com/downloads/zh-cn/confirmation.aspx?displaylang=zh-cn&FamilyID=e2a1a098-995e-4468-816d-7fdbe0a64f38
2.安装后需要安装window phone的SDK,这个我也是选择在线安装
可以到下面的链接下面下载一个vm_web2.exe。下载后直接安装
http://msdn.microsoft.com/en-us/library/ff402529%28v=vs.92%29.aspx?ppud=4
但是安装的时候出现了问题:
提示需要安装vs sp1
无奈又要去下载安装sp1
可以的到下面这个地址下载:
http://archive.cnblogs.com/a/1981374/ 里面的:
https://cid-3ca83445bd7767a0.office.live.com/browse.aspx/.Public/VS2010
下载visual_studio_2010_sp1.exe(我在想是不是可以直接安装这个以后再安装sdk就可以了呢?)
大概又需要半天的时间,人生有时候就是这么痛苦。
安装完毕后再打开vm_web2.exe
但是又遇到了问题:
解决方法是:
1、win+R、输入regedit,打开注册表;
2、删除:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
重新打开就可以安装啦
http://www.pocketdigi.com/20100827/75.html
有时候我们需要修改已经生成的列表,添加或者修改数据,notifyDataSetChanged()可以在修改适配器绑定的数组后,不用重新刷新Activity,通知Activity更新ListView。今天的例子就是通过Handler AsyncTask两种方式来动态更新ListView.从今天起,每次学习的源代码都会打包上传,方便各位同学学习,注册帐号即可下载。
布局main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView android:id="@+id/lv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>ListView列表布局playlist.xml:
<?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="30px" android:textSize="18sp" ></TextView>
程序代码:
package com.pocketdigi;
import java.util.ArrayList;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
public class main extends Activity {
/** Called when the activity is first created. */
ListView lv;
ArrayAdapter<String> Adapter;
ArrayList<String> arr=new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
lv=(ListView)findViewById(R.id.lv);
arr.add("123");
arr.add("234");
arr.add("345");
Adapter = new ArrayAdapter<String>(this,R.layout.playlist, arr);
lv.setAdapter(Adapter);
lv.setOnItemClickListener(lvLis);
editItem edit= new editItem();
edit.execute("0","第1项");//把第一项内容改为"第一项"
Handler handler=new Handler();
handler.postDelayed(add,3000);//延迟3秒执行
}
Runnable add=new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
arr.add("增加一项");//增加一项
Adapter.notifyDataSetChanged();
}
};
class editItem extends AsyncTask<String,Integer,String>{
@Override
protected String doInBackground(bbcode_editor.textarea.insertAfterSelection(response.responseText);
Element.scrollTo(editor.bbcode_editor.textarea.element);}
});
}
new WeiboShare({share_buttons: $('share_weibo'), img_scope: $('blog_content')});