摘要: public class MainActivity extends Activity { private EditText pathText; private TextView resultView; private Button downloadButton; private Button stopbutton; private ProgressBar progressBar; //hanlder的作用是用于往创建Hander对象所在的线程所绑定的消息队列发送消息 private Handler handler = new UIHander(); ... 阅读全文
posted @ 2014-01-10 16:54 天之涯0204 阅读(178) 评论(0) 推荐(0) 编辑
摘要: public class MulThreadDownloader { public static void main(String[] args) throws Exception { String path = "http://192.168.1.100:8080/web/QQWubiSetup.exe"; int threadsize = 3; new MulThreadDownloader().download(path, threadsize); } private void download(String path, int... 阅读全文
posted @ 2014-01-10 11:55 天之涯0204 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-10 11:03 天之涯0204 阅读(135) 评论(0) 推荐(0) 编辑
摘要: /** * 通过HttpClient发送Post请求 * @param path 请求路径 * @param params 请求参数 * @param encoding 编码 * @return 请求是否成功 */ private static boolean sendHttpClientPOSTRequest(String path, Map params, String encoding) throws Exception{ List pairs = new ArrayList();//存放请求参数 if(p... 阅读全文
posted @ 2014-01-09 16:26 天之涯0204 阅读(895) 评论(0) 推荐(0) 编辑
摘要: public class MainActivity extends Activity { private EditText pathText; private ImageView imageView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); pathText = (EditText) this.... 阅读全文
posted @ 2014-01-08 21:13 天之涯0204 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 内容提供者对外提供共享数据,需要在清单文件中进行配置,必须在应用的包或者子包下。ContentProvider类public class PersonProvider extends ContentProvider //必须继承ContentProvider类{ private DBOpenHelper dbOpenHelper; private static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH); private static final int PERSONS = 1; pr... 阅读全文
posted @ 2014-01-08 13:05 天之涯0204 阅读(343) 评论(0) 推荐(0) 编辑
摘要: item.xml MainActivity.javapublic class MainActivity extends Activity { private ListView listView; private PersonService personService; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ... 阅读全文
posted @ 2014-01-07 19:31 天之涯0204 阅读(468) 评论(0) 推荐(0) 编辑
摘要: // 通过SQLiteOpenHelper调用如下方法时会返回SQLiteDatabase,通过SQLiteDatabase可以对数据库进行操作getWritableDatabase()getReadableDatabase()public class PersonService { private DBOpenHelper dbOpenHelper; public PersonService(Context context) { this.dbOpenHelper = new DBOpenHelper(context); } public v... 阅读全文
posted @ 2014-01-06 19:43 天之涯0204 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-06 12:52 天之涯0204 阅读(121) 评论(0) 推荐(0) 编辑
摘要: person.xml liming 30 zhangxiaoxiao 25 public class PersonService { /** * 获取数据 * @param xml * @return * @throws Exception */ public static List getPersons(InputStream xml) throws Exception{ List persons = null; Person ... 阅读全文
posted @ 2014-01-05 21:16 天之涯0204 阅读(222) 评论(0) 推荐(0) 编辑