字节跳动Android岗社招面筋

一面:

1、首先是自我介绍(需要注意的地方:说有亮点的、跳槽原因,从各个点尽力彰显自己优势、技术特长)

2、手写代码:计算View树上所有view的数量,参数ViewGroup(本质上就是数据结构多叉树递归层序遍历+Android View基本api调用)

public int getCount(ViewGroup viewGroup){

 

        int count=viewGroup.getChildCount();

 

        //循环获取子View

        for(int i=0;i<count;i++){

            View child=viewGroup.getChildAt(i);

            if(child instanceof ViewGroup){

                //如果子View是ViewGroup,则用递归获取子View数量

                int childCount = getCount((ViewGroup)child);

                count+=childCount;

            }else {

                count++;

            }

        }

       

        return count;

    }

Android相关

3、主线程Looper一直循环查消息为何没卡主线程?

1)线程的阻塞状态(Blocked):阻塞状态是线程因为某种原因放弃CPU使用权,暂时停止运行。直到线程进入就绪状态,才有机会转到运行状态。

2)主线程Looper从消息队列读取消息,当读完所有消息时,主线程阻塞。子线程往消息队列发送消息,并且往管道文件写数据,主线程即被唤醒,从管道文件读取数据,主线程被唤醒只是为了读取消息,当消息读取完毕,再次睡眠。因此loop的循环并不会对CPU性能有过多的消耗。

 

4、RecyclerView相对ListView区别?

1)从布局效果上

2)从缓存机制上

5、Bitmap resize相关,设置optiondecode

6、用MultiDex解决何事?其根本原因在于?Dex如何优化?主Dex放哪些东西?主Dex和其他Dex调用、关联?Odex优化点在于什么?

答:MultiDex解决方法数65535的限制问题,即方法数不能超过65535个;方法idshort类型4个字节来存储的,所以数目范围应在0-2^320-65535MultiDex工作原理分析和优化方案; dex中:应用启动就必须加载的类,有一个keep文件来控制;其他dex文件都是通过主dex加载进来的;odex优化点:预加载;

 

7、DalvikArt虚拟机区别?

9、多渠道打包如何实现(FlavorDimension应用)?从母包生出渠道包实现方法?渠道标识替换原理?

10、Android打包哪些类型文件不能混淆?

11、Retrofit主要实现机制? Retrofit的作用、原理

12、动态代理静态代理区别?

13、模块化怎么做?怎么设计?接口发现暴漏怎么做?基于什么基本思想?

14、MVCMVPMVVM应用和彼此本质区别?

 

二面:

1、Glide缓存特点

2、问了擅长哪个方向?回答UI动画,所以就问UI相关的

1launcher应用抽屉,之前有个毛玻璃效果背景,从系统ROM角度说下怎么做?

2)实时的睡眠水面倒影效果怎么做? 实时更新的UI性能如何保证?

3UI基础:MeasureLayoutdraw大流程、绘制顺序,FlowLayout怎么实现?

3、算法题:两个线程分别持续打印奇数和偶数,实现两个线程的交替打印(从小到大)
public static void main(String[] args){
        Counter counter=new Counter();
        new Thread(new PrintOdd(counter)).start();
        new Thread(new PrintEven(counter)).start();
    }

    static class PrintOdd implements Runnable {
        public Counter counter;

        public PrintOdd(Counter counter) {
            this.counter = counter;
        }

        @Override
        public void run() {
            while (counter.value<=100){
                synchronized (counter){
                    if(counter.odd){
                        System.out.println(Thread.currentThread().getName()+":"+counter.value);
                        counter.value++;
                        counter.odd=!counter.odd;
                        counter.notify();
                    }
                    try {
                        counter.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
    static class PrintEven implements Runnable {
        public Counter counter;

        public PrintEven(Counter counter) {
            this.counter = counter;
        }

        @Override
        public void run() {
            while (counter.value<=100){
                synchronized (counter){
                    if(!counter.odd){
                        System.out.println(Thread.currentThread().getName()+":"+counter.value);
                        counter.value++;
                        counter.odd = !counter.odd;
                        counter.notify();
                    }
                    try {
                        counter.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    static class Counter{
        public int value = 1;
        public boolean odd = true;
    }

4、模块化、工程化架构思想

 

三面:

1、设计个IM客户端以及数据库架构,类似微信,偏上层业务部分的会话、联系人、通知、

2、公众号如何存、分几张表,架构每一层都是什么,互相怎么交互工作?

 

#字节跳动##安卓工程师##社招##面经#
全部评论
哇 工作几年的呀?tql 老哥
点赞 回复
分享
发布于 2020-07-04 01:01
头条的编程题这么奇葩
点赞 回复
分享
发布于 2020-07-27 14:34
小红书
校招火热招聘中
官网直投

相关推荐

5 50 评论
分享
牛客网
牛客企业服务