Answer: C we have to edit the emulator using avd manager and use sd card option check and set the memory for it.
Description: We can simulate SD card with emulator using SD card check option in emulator settings in AVD manager.
Answer: B Application
Description:
Answer: C i,ii, & iii
Description:
Answer: D All
Description:
Answer: C i & iii
Description: Generally when we use some images in our projects as background for some views, and that application is downloaded into various devices with different screen sizes, then based on the screen sizes that image will stretch and adjust it self to the scree sizes.
But the problem is, when the image gets stretched to fit the screen size, some times the resolution of the image gets damaged and will not look good in bigger screen devices.
To avoid this problem, we use 9 patch tool.
Using 9 patch tool, we can set scaling factor on x, y directions of our image using this tool. This is to make sure that image will be re sized properly based on screen sizes. And we can also set padding factor on x, y directions of our image using this tool. padding factor is to make sure that content of that image will be aligned properly in the image.
Answer: A Parcels are light weight serializables. It is preferred to use parcels for marshaling objects into byte streams.
Description: These concepts are related to Inter Process Communication (IPC).
When sending data between two applications, we have to make sure that both applications should understand the format of the data that is being sent.
Especially when you are sending non primitive data type values like classes and objects between two applications, We have to convert them into Operating System understandable format. O.S understands only primitive types (ints, chars etc). The reason for conversion is we have to O.S communication channel to transmit the data.
This process of converting Non primitive types to primitives and sending across to other application over some communication channel is called as Serialization. The reverse process is called as De Serialization.
In Java, IPC depends heavily on Serializables for serialization. But serialization is designed by keep desktop applications in mind. When you are doing IPC in mobile applications we have to make sure that the process of IPC is not too heavy.
In simple terms serialization is a heavy concept for IPC.
So in place of Serialization Android opted for Binders for achieving light weight Inter process communication. Binders internally depends heavily on parcels, to do the IPC.
Parcels are light weight serializables. It is preferred to use parcels for marshaling objects into byte streams.
Note: Binder IPC heavily depends on Shared memory concept to make sure that there is not much data duplication while sharing between applications.
Answer: D you can uses both option 2 and 3
Description:
Answer: D All
Description:
Answer: B Java Native Interface that enables Java to call native application written in C,C++.
Description:
Answer: D This is the interface for text to which markup object can be attached and detached.
Description:
Answer: D i, ii, iii, & iv
Description: Compatibility : Is to create an application targeting for both mobiles and tablets efficiently (keeping space and size in mind).
For that we have to use
1.Activities
2. Fragments. (To use space efficiently in tablets)
3. Since device screen sizes may vary, we have to make sure that our images used in that application should re-sized properly for all screen sizes. This can be achieved using draw9patch tool. (9 patch images)
4. We have to minimize the usage of absolute layouts and hard coded pixels in the xml layout files. Because if we use absolute pixels then it won't look proper when screen sizes changes. We should always mention the pixels in terms of screen width and height in which our application is downloaded. This can be done by using dp (density independent pixels).
Answer: D all of the above.
Description: Compatibility issues generally arise when our application is downloaded into devices with different screen sizes and screen resolutions. So first basic problem may come in case of tablets as activity don't use space efficient, so we have to sue fragments also. second problem may come in image scaling and re-sizing, so we have to use 9patch tool. third problem may come if we use hard coded or absolute pixels in xml layout files, so avoid it.
Answer: B i & ii
Description: Both activity & service will have its own contexts.
Note : You can't access activity's context from an inner class directly, rather you have to use ActivityName.this to access its context.
Answer: B i & ii
Description:
Either use getApplicationContext() while creating UI control. Or break the link between static variable and the UI control.
Below is one example program, on memory leak and how to resolve it.
public class MemoryleakActivity extends Activity {
/** Called when the activity is first created. */
private static Drawable sBackground;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView label = new TextView(this);
label.setText("Leaks are bad");
if (sBackground == null) {
sBackground = getApplicationContext().getResources().getDrawable(R.drawable.icon);
}
label.setBackgroundDrawable(sBackground);
setContentView(label);
}
@Override
protected void onDestroy() {
sBackground.setCallback(null);
super.onDestroy();
}
}