J brother --------- interview Summary of Beijing Android recruitment companies, --------- android

Source: Internet
Author: User

J brother --------- interview Summary of Beijing Android recruitment companies, --------- android
From:After thinking twice, I decided to sum up my interview today. If I could help my friends who are looking for a job, I would not be able to get any better.Ps: the interview is really tiring today. I didn't have a good sleep last night. I didn't get up or have breakfast this morning. I ran to the interview hungry. After talking about things, I interviewed two companies today. Before going out in the morning, I felt the two companies could win the interview, but the results were not satisfactory ..

Interview company: A company near jiandefen interview time: May 25 AM. Interview results: the last chat salary is 14 salary/16 K There is a meal every day. (But I didn't give an offer on the spot. For details, I will introduce the interview process below.) interview process: 11: 00 company meeting (I am waiting, I am waiting) 12: 00-with two android programmers +Technical DirectorPk. PM-PM: Talk to the two personnel about the ideal of life.
Interview records:
: To the company, there is a desk ball behind the front desk, a variety of fruits, I feel the company atmosphere is good. When I arrived at the company, I had more than 11.00 yuan. On Monday, when their team had a meeting, I was taken to a meeting room by a little brother. I poured a glass of water and I threw my brother there. In the meeting room, I heard the meeting room next door, and the people who came to the interview were a little funny. I vaguely remembered to ask, if there are other companies with high salaries, you may go 2828. (PPS: Interview technology is one aspect, and personnel cannot be ignored .)
12: 00: (a round of PK) the meeting was over, but my brother was hungry. This company did not have a pen question. He came in directly with an Android buddy and gave a brief introduction, then we chatted. First, J brother briefly introduced the role of the previous company, the development process, and so on, then J brother said that there are about five apps developed in the company, I personally took a private activity, and then I had nothing to do with the two applications, and then J brother showed him the application. He watched the company and praised it... (Lalala is actually a project of online Bala by j ge .) (Then he introduced the basic framework of the project, which is in the v4 package.Nested SlidingPaneLayoutRound RobinCustom viewpager. Then, the specific interface is a waterfall stream. The key of the project is to process the image. Because there are N images, but they are not stuck, therefore, I used the open-source imagedownloader and volley and the lrucache to cache bitmap objects. Here, you must clearly understand the three-level cache of images. I will ask about the basic interview .)In fact, how do you avoid oom, the cause of Memory leakage, and how to handle large images? In fact, how do you optimize the memory.According to my own summary, you can say that this is the same as oom and Memory leakage. The key is how to optimize the memory to avoid unnecessary Memory leakage,I have summarized the cause of Memory leakage by four points,1. Anonymous internal class and non-static internal class. For example, we use handler to define the handler in the activity as follows:

Handler mHandler = new Handler() {    @Override    public void handleMessage(Message msg) {        mImageView.setImageBitmap(mBitmap);    }}
Then, right-click the project to run the lint tool, android tools --- run lint, and we will be prompted with a 'warning: In Android, Handler classes shocould be static or leaks might occur. '.
That is, it is recommended that we define handler as static, specific here to explain in detail: http://www.linuxidc.com/Linux/2013-12/94065.htmSimilarly, there are anonymous subthreads.
2. Take online chestnuts for example,
Vector v = new  Vector( 10 );  for  ( int  i = 1 ;i < 100 ; i ++ ){  Object o = new  Object();  v.add(o);  o = null ;  } 
Even if we set the o object to null, there is still an o reference in the vector set, so the set is not cleared, and this part of memory cannot be released, which leads to memory leakage.
3. When we operate the database, we did not close cursor after executing the corresponding crud method. close () or db. close () will also occupy the memory, because GC will be collected only after the connection is closed.
4. Continue to give example.
Set <Person> set = new HashSet <Person> (); Person p1 = new Person ("Tang Seng", "pwd1", 25 ); person p2 = new Person ("Sun Wukong", "pwd2", 26); Person p3 = new Person ("", "pwd3", 27); set. add (p1); set. add (p2); set. add (p3); System. out. println ("Total:" + set. size () + "elements! "); // Result: There are three elements in total! P3.setAge (2); // modify the age of p3. At this time, the hashcode value corresponding to the p3 element changes set. remove (p3); // at this time, the remove operation fails, causing memory leakage set. add (p3); // add again. The System is successfully added. out. println ("Total:" + set. size () + "elements! "); // Result: There are 4 elements in total!
J brother personally practiced and found the problem. This online Chestnut is wrong. It is actually a sad story that can be removed. This Chestnut is incorrect .. There is such an article on the Internet .. Here, let's take a look at the summary on other websites: We strongly recommend http://developer.51cto.com/art/201111/302465.htm. Very detailed. OK. The last point is about the timely release of bitmap objects in images. I will not elaborate on them here. I will summarize them together after the three-level cache of images.
Now I feel that the opposite android brother has been attracted by me. It seems that I am listening to my lectures very seriously. Then, he asked me questions. I made a general summary. Interviewer 01: Have you ever customized the view.
J's answer: This is very common. I have defined a lot by myself, such as pull-down refresh and pull-up listview with more data, similar to the pulltorefreshlistview on github. In addition, viewpager for image polling playback inherits viewpager and starts a thread to control switching. For example, the textview, scrollview, and listview of the running horse lighting effect are nested with each other, which leads to incorrect calculation of listview height. I also customize the listview, rewrote the onmeaure method, and then solved the conflict. For example, I have done some open-source images that can be zoomed in and out, mainly for the onmeasure method, onlayout method, and ondraw method. Review your touch events and so on. By the way, our company needed to build a screen lock software to slide and unlock it. I also defined it myself, then I showed it to him. The article was here. Portal http://blog.csdn.net/u011733020/article/details/41864241.
Interviewer 01: listview optimization,
J's answer: (PS: This is basically a bad question, but there is no way to answer it .) As the most common view for displaying data, listview is usually optimized from four aspects. 1. Reuse convertview. Otherwise, if there are 1000 pieces of data, we will slide and generate 1000 convertviews. This is a huge waste of memory, so we must reuse them. 2. reduce the number of times of findviewbyid, because each execution of findviewbyid also consumes resources. We need to minimize the number of resources. Generally, we define a viewholder to manage these IDs, then, the id is obtained directly through the tag. 3. Paging loading and delayed loading. In our previous project, there was a list with a large amount of data and a large amount of data from one request. There are two problems: one is that the request network may take a long time, another experience on displaying data is not very good, so we load 20 records for the first time, and then load 10 new data records for each request. 4. Optimize some similar portraits and images in listview. This is similar to the third-level cache. We recommend that you take a look at the source code of the open-source universal-image-loader. Or in this article, http://www.jb51.net/article/38162.htm. j has time to write an article that is too cached.

Interviewer 01: Check whether your resume has been used for social networking and communication.
J Ge replied: I think our company has also used chat. We do it ourselves or use third-party similar huanxin. The result was guessed by brother J. He said it was integrated huanxin (but there was packet loss, so he planned to communicate on his own ).
OK, said J GE. The chat in our project was based on the xmpp protocol. Before android was available, java had an open-source smack and android now had an asmack, in fact, it is transplanted to android. The server is based on openfire. We are doing openfire + asmack chat. This principle is mainly to bind an ip address to the connection, connect it, And then communicate, I said that, in principle, this is the same as the http request, it is bound to an ip address, and then set some properties, and then communicate through similar streams. asmack, in fact, the underlying layer is xml communication.

Interviewer 01: The transfer mechanism of touch events has also been specially drawn. One is the nested button LinearLayout.
J's answer: That's it. It's hard for me. Because J brother thinks this question will certainly be asked, so I have prepared for it. Here I will make a general conclusion and send you the detailed principles. I replied, this is very simple, as long as you inherit the three methods of "dispatchtouchEvent onInterceptTouchEvent" and "linearlayout. you can clearly understand the transfer process. I will give you a general conclusion. Click this button. Generally, the external parent control first responds to this down event and then transmits it to the subclass, let the subclass be passed to the lower-level subclass of the subclass, so that the final child decides not to consume this click event. If it is consumed, the parent class will not respond, if the child class is not consumed, It will be returned to the Child class and checked to see whether the Child class is to be consumed. In this case, the child is passed to the parent class, and the child decides whether to consume the Child class or not. Here is a detailed introduction to the distribution of parcel events. So I'm not arrogant, http://blog.csdn.net/yanbober/article/details/45887547? Ref = myread

Interviewer 01: Picture optimization in the project.
J Ge replied: One of the projects I showed him had a lot of pictures, but they were smooth and didn't have oom. For image optimization, we generally use level 3 cache, 1. Memory loading 2. Local Loading 3 network loading. First, let's see if there is any memory that can be used directly. Here we do this in our project. First, let's get the available memory allocated to our application, then use 1/4 or 1/8 as an lrucache. add our bitmap object. Some commonly used images will be saved locally to avoid repeated Online downloads. Combined with the open-source afinal universalimageloader and volley officially recommended by Google for 13 years (known as asynchttpclient and Universalimageloader), So I have never encountered the oom problem caused by images in my project. For a single large image, I will also use bitmapFactory to calculate the size, then calculate the resolution of the mobile phone and perform quantitative compression.

Interviewer asked: GC collection
J Ge replied: I said. GC collection should not just follow one method, but there should be a variety of different algorithms. I have read a point on Google's official website that there is such a region, which is divided into latest (recent) middle (medium) permanent (permanent. They are stored separately, newly created, and objects that have been created for a long time are constantly added to latest. When the threshold value of the corresponding object region is reached, GC is triggered. When GC is recycled, the recovery speed in latest is the fastest, and permanent is the longest, and the time is also related to the number of objects in each region, another algorithm is to perform GC based on the time when it was recently referenced or the number of times it was referenced. GC collection is not performed immediately. Is not scheduled. GC will block the thread during garbage collection, so you should avoid creating unnecessary objects in the Code. for example, creating a large number of objects in the for Loop will easily cause GC. When we can also manually execute system. gc () in the method to manually release some resources.

Interviewer 01: How to Prevent viewpager from preloading fragment,
J's answer: I have also encountered this problem. We all know that viewpager will pre-load two objects and the current one, while viewpager setOffscreenPageLimit (0) it does not take effect because the source code knows that at least one method will be loaded by default. Therefore, this fragment has not been displayed on the current page and is already clipped. It is possible that the data is not up-to-date. In the setuservisibilityhint () method, I dynamically judge whether to refresh it with the parameter.

After a round of inquiry, this buddy probably had no question. Then let me wait and say that they should come to the technical director. I will wait... Then, after waiting for a few minutes, a little girl came in and sat down. After reading my resume, I thought it was a human resource and came to talk to me about my ideal life. As a result, let me talk about my project without a few words. I qu, stunned me. I asked, you are also working on android, and I went there. It was like this. I scared brother J and asked him a few questions.

Android girl asked: Check that the item type in the listview in your project is uniform, and how do you reuse the items that are quite different when you add the items.
Brother J replied: "I think of two ways for the time being: 1. add a type to this object and reuse it based on the type, or load these types together, and then control display hiding. Then I asked the girl, if I had one hundred million pieces of data, the one hundred pieces were unordered and included 10 types of items. Do you have any good solutions to solve this problem, if you do not define a type, we will judge it through the type.
Android girl asked: onAttch on DetachOr onAttachedToWindow? OnDetachedFromWindow
Brother J replied: Actually, the little girl forgot the two methods. What method do I use? She said onAttachIntent () and onDetachIntent (). I have never heard of it. I have only seen onAttach, but I have never used this method. I asked her what the two methods do. The girl told me that the sub-view was bound to the interface, so it should be OnAttachedToWindow OnDetachedFromWindow method, smallThe girl said: This method can calculate the height and width of the sub-view, which cannot be calculated in oncreate. In fact, although it cannot be calculated in oncreate, there is still a method to calculate it, (I think the interview is the best API, so I can't help but talk about it. I have met,Camera took a photo and asked me if I could get an image or video. I went to Baidu and I knew it as soon as possible. I really didn't know why I would ask. Baidu is a programmer ..)
I don't quite remember the other questions I talked to. I feel like a female programmer .. I was not very impressed by the method. No matter the method is useless, I think it is better to directly ask you for the method 2 in the interview...
Then the technical director came in and talked to me. Then the technical director came in and talked to me. The Technical Director was in his early 30 s and didn't ask me any technical questions,

Director: I asked if I had never done communication.
J Ge replied: As I said, communication involves several protocols. We use xmpp protocol, the server is built based on openfire of apache, and the client uses asmack. There are also some other protocols, such as the soap protocol used in some projects and the ip protocol. PS: Pull
I said that the communication client is okay, but I have always been focusing on android mobile development on the server end since my work. If the data volume is large, I have to consider concurrency and so on, I can't do it. I may be able to make a tomcat demo.
Other things are also casually talked about, and then said, Let the personnel talk to me about the ideal. Director: When can I go to work?
J Ge replied: I said this depends on the company's needs.
Other things are also casually talked about, and then said, Let the personnel talk to me about the ideal.
It should be okay here. It's almost time to win.
Personnel 1: When you come in, ask east and west. Ask about overtime work. Generally, their company's technology is 8 o'clock. It is said that there are basically no routes at 7: 00 ,,,

J Ge replied: I said, generally, there is nothing to do with project addition, version upgrade, and so on, as long as it is not always working overtime .... Here, everyone thinks it's okay. Anyway, people keep stressing this with me, and she keeps stressing that I am secretly making up her mind that I will not lose my salary.


Personnel 1: you are still young. You can fight together ,,,,

J Ge replied: I said that the past few years have been a very important period for my life planning. It was also a year before I was a young man. In fact, she meant to emphasize overtime .... UZI.

There was a bunch of nonsense in the middle. Then I asked her about the company's normal commuting time .. Is there any technical exchange or something like that... Finally, the key issue is the salary issue, which is of the greatest concern.
Personnel 1: Expected salary

Brother J replied: I 'd like to say about 16 K. She asked you how many handshakes you had in the past: 15 K. She said their company was paid for 14 yuan. I would like to say 16 K. She said that's good. Wait, and then she goes out.


I don't know who I 've been talking to for a long time. Then another possibility is personnel. I asked again, and I also asked about salary .. Say 16 K. .. It is estimated that their company wanted me, but they thought it was a little more than their salary expectations. They were not given any offer on the spot. Then I was a bit declined, saying that I was angry when I gave me a reply in two days. When I had a hungry stomach interview at three points, I declined ,,,
Anyway, I am very angry. I said, okay, then I will leave. As a result, after an hour, the personnel called again and asked me to meet their CEOs. What the hell is this? Are their CEOs trying to give me a try? I can say yes, and the time is set to be the day after tomorrow. It is useless for me to get chicken soup,
OK. This interview is written here first, and there will be another one in the afternoon. Prepare for sleep. I fell asleep when I came back from the interview today. I woke up more than 10 o'clock in the evening. I thought about the interview process. ------------------------------- To be continued------------------------- ========================================================== ========================================================== =====







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.