<thead id="kqoxr"></thead>
<blockquote id="kqoxr"></blockquote>
<legend id="kqoxr"><li id="kqoxr"></li></legend>
    1. <sub id="kqoxr"></sub>
      1. <blockquote id="kqoxr"><i id="kqoxr"><noscript id="kqoxr"></noscript></i></blockquote>
        <pre id="kqoxr"></pre>

        91午夜福利在线观看精品,亚洲综合色婷婷中文字幕,亚洲日本欧洲二区精品,竹菊影视欧美日韩一区二区三区四区五区,亚洲色在线V中文字幕,国产精品毛片av999999,精品视频不卡免费观看,亚洲全乱码精品一区二区

        android面試題(2)

        時間:2024-10-15 04:42:28 學人智庫

        android面試題(2)

          Intent intent = new Intent(this,B.class);

        android面試題(2)

          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

          局限性 :所有的activity的啟動模式都要是默認的啟動模式

          講一講你對activity的理解

          把上面的幾點用自己的心得寫出來

          8. service是否在main thread中執行, service里面是否能執行耗時的操作?

          默認情況,如果沒有顯示的指定service所運行的進程, Service和activity是運行在當前app所在進程的main thread(UI主線程)里面

          service里面不能執行耗時的操作(網絡請求,拷貝數據庫,大文件 )

          在子線程中執行 new Thread(){}.start();

          特殊情況 ,可以在清單文件配置 service 執行所在的進程 ,讓service在另外的進程中執行

          9. 兩個Activity之間怎么傳遞數據?

          基本數據類型可以通過. Intent 傳遞數據

          extras.putDouble(key, value)

          intent.putExtra(name, value)

          // 通過intent putExtra 方法 基本數據類型 都傳遞

          Bundle bundle = new Bundle();

          bumdle.putShort(key, value);

          intent.putExtras(bundle);

          intent.putExtras(bundle)

          獲取到激活他的 getIntent();

          Intent intent = getIntent();

          Bundle bundle = intent.getExtras();

          intent.getStringExtra("key","value");

          intent.getBooleanExtra("key","value")

          Application 全局里面存放 對象 ,自己去實現自己的application的這個類,基礎系統的application , 每個activity都可以取到

          讓對象實現 implements Serializable 接口把對象存放到文件上.

          讓類實現Serializable 接口,然后可以通過 ObjectOutputStream //對象輸出流

          File file = new File("c:\\1.obj");

          FileOutputStream fos = new FileOutputStream(file);

          ObjectOutputStream oos = new ObjectOutputStream(fos);

          Student stu = new Student();

          stu.setId("10001");

          stu.setName("zs");

          oos.writeObject(stu);

          FileInputStream fis = new FileInputStream(file);

          ObjectInputStream ois = new ObjectInputStream(fis);

          Student stu1 = (Student) ois.readObject();

          System.out.println(stu1.getName());

          Parcelable 和 Serializable

          Parcelable 把對象序列化到android操作系統 的一塊公用的內存空間

          文件/網絡

          intent.setData(Uri)

          Uri.fromFile(); //大圖片的傳遞

          contentResolver.getInputStream(url);

          10. 怎么讓在啟動一個Activity是就啟動一個service?

          在activity的onCreate()方法里面 startService();

          11. 同一個程序,但不同的Activity是否可以放在不同的Task任務棧中?

          比方說在激活一個新的activity時候, 給intent設置flag

          Intent的flag添加FLAG_ACTIVITY_NEW_TASK

          這個被激活的activity就會在新的task棧里面…

          Intent intent = new Intent(A.this,B.class);

          intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

          startActivity(intent);

          12. Activity怎么和service綁定,怎么在activity中啟動自己對應的service?

          startService() 一旦被創建 調用著無關 沒法使用service里面的方法

          bindService () 把service 與調用者綁定 ,如果調用者被銷毀, service會銷毀

          bindService() 我們可以使用service 里面的方法

          bindService(). 讓activity能夠訪問到 service里面的方法

          構建一個intent對象,

          Intent service = new Intent(this,MyService.class);

          通過bindService的方法去啟動一個服務,

          bindService(intent, new MyConn(), BIND_AUTO_CREATE);

          ServiceConnection 對象(重寫onServiceConnected和OnServiceDisconnected方法) 和BIND_AUTO_CREATE.

          private class myconn implements ServiceConnection

          {

          public void onServiceConnected(ComponentName name, IBinder service) {

          // TODO Auto-generated method stub

          //可以通過IBinder的對象 去使用service里面的方法

          }

          public void onServiceDisconnected(ComponentName name) {

          // TODO Auto-generated method stub

          }

          13. 14 .什么是Service以及描述下它的生命周期。Service有哪些啟動方法,有什么區別,怎樣停用Service?

          在Service的生命周期中,被回調的方法比Activity少一些,只有onCreate, onStart, onDestroy,

          onBind和onUnbind。

          通常有兩種方式啟動一個Service,他們對Service生命周期的影響是不一樣的。

          1 通過startService

          Service會經歷 onCreate 到onStart,然后處于運行狀態,stopService的時候調用onDestroy方法。

          如果是調用者自己直接退出而沒有調用stopService的話,Service會一直在后臺運行。

          2 通過bindService

          Service會運行onCreate,然后是調用onBind, 這個時候調用者和Service綁定在一起。調用者退出了,Srevice就會調用onUnbind->onDestroyed方法。

          所謂綁定在一起就共存亡了。調用者也可以通過調用unbindService方法來停止服務,這時候Srevice就會調用onUnbind->onDestroyed方法。

        【android面試題(2)】相關文章:

        android面試題目09-08

        Android工程師的面試題08-07

        Android工程師面試題10-24

        關于Android工程師面試題09-19

        德國公司經典面試題(2)07-10

        Microsoft面試題09-04

        iOS面試題07-10

        公司面試題09-12

        hibernate面試題10-18

        英語面試題精選06-13

        主站蜘蛛池模板: 精品 日韩 国产 欧美 视频| 无码人妻精品一区二区三区蜜桃91| 欧美日韩精品乱国产| 丰满少妇高潮无套内谢| 久久在线看| 亚洲AVAV天堂AvAv| 377人体粉嫩噜噜噜| 国产日韩av二区三区| 99国产欧美精品久久久蜜芽| 夜色资源站国产www在线视频| 日韩亚洲国产中文字幕欧美| 国产欧美精品一区二区三区-老狼 真实单亲乱l仑对白视频 | 久久av在线影院| 亚洲男人天堂av在线| 亚洲欧美不卡视频在线播放| 久久久亚洲精品一区二区三区| 亚州Av无码| 国产刺激爽爽在线视频| 国产精品久久蜜臀av| 精品日本乱一区二区三区| 成人国产综合| 无码人妻丰满熟妇a片护士| 免费人妻AⅤ无码专区久久综合| 很黄很污的视频网站| 国产成人一区二区三区视频免费| 7878成人国产在线观看| 国产萌白酱喷水视频在线观看| 色AV天堂| a视频免费在线观看| 国产AⅤ爽aV久久久久成人小说| 免费 黄 色 人成 视频 在 线| 亚洲av永久无码精品漫画| 伊人精品久久久大香线蕉| a天堂视频在线观看| 无码中文字幕AV免费放软件| 亚洲成在人线在线播放无码| 亚洲人成网站18禁止无码| 亚洲精品色哟哟一区二区| 99精品在线观看| 亚洲国产日韩欧美一区二区三区 | 蜜臀人妻精品一区二区免费|