1. Android architecture explains all the layer
2. Where share preferences data is Saving in android
3. How to make our own app launcher
4.what is bound service.. how it’s working
5. What is intent filter
Ans:- An Intent filter is an expression in app's manifest file that specifies the type of intent that the component would like to receive would like to receive . Its like directly start an activity with certain kind of intent.
6. What is component/element of intent filter :-
There are 3 element of intent :-
1. action:- This is mandatory part of the Intent object. Here we r giving predefine action to performed by target activity.
2. data:- this specifies the data type expected by the activity.
3.category:- It is optional part, its like a additional information about the action.
7. How to create table in SQLite.
SQLiteDatabase db = db=openOrCreateDatabase("MyDatabase", Context.MODE_PRIVATE,null);db.execSQL("create table if not exists student(ID integer PRIMARY KEY AUTOINCREMENT NOT NULL,NAME varchar(20),PHONE varchar(11))");
Insert:ContentValues cv=new ContentValues();cv.put("ID",Integer.parseInt(edtId.getText().toString().trim()));
9. What is retrofit :-
8. How to make todo app in android write steps and flow
Ans:- Retrofit is REST client for java and android. Its make easy to retrive and upload JSON or other structure data via REST base services. In Retrofit we can configure that which converters factory can use to parsing of data. Typically in Retrofit we are using GSON , but we can also add custom converter factory to process XML or other protocols. Retrofit using IkHttp library for HTTPS request.
10. How to call retrofit
Ans:- To call Retrofit we basically require 3 things :-
A. Model class of request and response which is used as a JSON model.
B. Interfaces that define the possible HTTPS operations.
C. Retrofit.Builder class :- This class will return the instance of the Interface class , it will also allow to define Base url for HTTP request.
Every method of interface represent one possible API call.It must have HTTP annotation (GET,POST, etc) which specify the request type and relative URL.
Source:- https://www.journaldev.com/13639/retrofit-android-example-tutorial
11. How R.java is creating in android
Ans:- Android R.java is an auto-generated file by aapt (Android Asset Packaging Tools) that contain resource IDs for all the resource of res/directory. If we create a XML file than the id for the corresponding component is automatically created in this file, this id use to perform any action on the component.
12. Who is creating r. Java in android studio :-
aapt (Android Asset Packaging Tool)
13. How apk in android creating .
14. What is garbage collection :-
Ans:- It will free unreferenced memory. Internally GC maintaining a tree , in that if any node not refer any root than GC will collect that memory and become free that node from memory.
There are 3 steps for the G.C:-
A). Mark:- It will mark all the unreferenced memory.
B). Sweep:- It will delete/free all marked memory.
C). Compaction:- It will compact all free memory to make a bigger chunks.
Types of G.C:-
a. Serial GC :-
When mark and sweep will run all task will stop.
It is bad user experience.
Single threaded process.
b.Parallel GC:-
In this also when mark and sweep run no other thread of application will run.
But in this mark will be multithreaded so mark will completed very fast.
c. Hybrid GC:-
It use CMS (Concurrent mark and sweep Algorithm).
It is same like parallel but in this application thread can run during mark and sweep.
15. What to do when ur app is saying out of memory.
Ans:-
Q. What is Memory leaks.
A memory leak happen when memory is allocated but never freed.It means memory are out of GC reach.
Its like if we did not free our home for 2 Weeks than imagine what will happen it may smell right? Same way if user keep on using app than memory also keeps on increasing ,if memory leak are not plugged than than unused memory never will free by GC. In this case we will get popup ANR which will crashed the application.
Q. How we can check that our app is leaking?
Ans:- there is an awesome library called "LeakyCabary" which we can use to see leking of memory in app along with stack trace.
Q. Common mistakes that leads to memory leaks.
Ans:-
1. Broadcast Receivers:- we use a broadcast receiver but we didn't unregister the broadcast receiver then it will holds the reference of activity even if we close the activity. To fix this always we have to call unregister receiver inStop() of activity.Good practice is like always try to call or register a receiver in inStart() or onResume() of activity.
2. Static Activity or View Reference :-
If we reference any view like: TextView,Button as static than the activity would not be garbage collected after it destroyed. So Always remember to Never use static variable for view or activity or contexts.
3. Inner class reference.
Ans:- Never make any static variable inside inner class. The class should be set to static. Use weak reference of any view and activity.
4. Use applicationContext() instead of activity context if possible.
source:- https://android.jlelse.eu/9-ways-to-avoid-memory-leaks-in-android-b6d81648e35e
16. Screen orientation .. when we change screens orientation where to write toast that screen orientation changes
17 . How many thing we can call on configuration changed methods
18. What is AAPT (Android Asset Packaging Tool)) :-
AAPT is a build tool that Android Studio and Android Gradle Plugin use to compile and package your app’s resources. AAPT2 parses, indexes, and compiles the resources into a binary format that is optimized for the Android platform.
19. From which layer of android architecture app will communicate hardware .
20. What is monkey test .
Random test done by QA
21. What is single top which use in android activity
22. In what format data is saving in shared preference.
Key and value
23. Sensor in android.
24. What is service and its type explain.
25. What is difference between process,thread,task and service.
25. What is component of Android.
26. OOPS concept .
27. Explain following:-
Static,Abstract,Interface,final,synchronized,thread.
28. Write multithreading program.
29. What is RetroLambada.
Retrolambda is a library which allows to use Java 8 lambda expressions, method references and try-with-resources statements on Java 7, 6 or 5.
In earlier versions of Android, Java 8 was not supported. Retrolambda provides a way to use "lambda expressions" on Java versions below 8.
Common examples of lambdas in Android are for click listeners
The Gradle Retrolambda Plug-in allows to integrate Retrolambda into a Gradle based build. This allows for example to use these constructs in an Android application, as standard Android development currently does not yet support Java 8.
TextView textView = (TextView) findViewById(R.id.text_view);