开发者

How does android communicate with dynamic services?

I am trying to develop an app and I want it to bring in data from a mySQL database. But from some reading I have done开发者_运维知识库 on different sites, I am realizing that it is probably not going to happen. But I am curious to know, how do apps like PhoneFlix and others view that dynamic data on the application? Does it somehow just bring it in through http? If so, how would I go about doing that? Does anyone know of any good sites that will point me in the right direction? Thanks

ezekielweb


Well, first of all, android provides sqlite, not mysql. :)

You can create a thread that does whatever you want it to and it can communicate with the front activity with Bundle when you implement Handler in your activity.

such as below...

private void do_what_i_want() {

  new Thread() {

   public void run() {

     Bundle b = new Bundle();
     b.putString("whatyouwant", value);

     Message m = new Message();
     m.setData(bundle);
     handler.sendMessage(msg);
   }

 }.start

}


private Handler handler = new Handler() {

 @Override

 public void handleMessage(Message msg) {

   super.handleMessage(msg);

   Bundle b = msg.getData();

   String whatyouwant = b.getString("whatyouwant");

   ["you can refresh your view here"]

 }

}

hope I'm on the right track... :p

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜