Application Development Questions

Q:

If I call performSelector:withObject:afterDelay: – is the object retained?

Answer

Yes the object is retained. It creates a timer that calls a selector on the current threads run loop. It may not be 100% precise time-wise as it attempts to dequeue the message from the run loop and perform the selector.

Report Error

View answer Workspace Report Error Discuss

0 2337
Q:

When is the onStop() method invoked?

Answer

A call to onStop method happens when an activity is no longer visible to the user, either because another activity has taken over or if in front of that activity.

Report Error

View answer Workspace Report Error Discuss

0 2291
Q:

In HTML 5 we do not need DTD why?

Answer

HTML 5 does not use SGML or XHTML it’s completely a new thing so you do not need to refer DTD. For HTML 5 you just need to put the below doctype code which makes the browser identify that this is a HTML 5 document.

Report Error

View answer Workspace Report Error Discuss

2 2280
Q:

What are intents, shared preference in android ?

Answer

An Android Intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.The intent itself, an Intent object, is a passive data structure holding an abstract description of an operation to be performed.
Android provides many ways of storing data of an application. One of this way is called Shared Preferences. Shared Preferences allow you to save and retrieve data in the form of key,value pair.


In order to use shared preferences, you have to call a method getSharedPreferences() that returns a SharedPreference instance pointing to the file that contains the values of preferences.

Report Error

View answer Workspace Report Error Discuss

3 2243
Q:

Why an app on iOS device behaves differently when running in foreground than in background?

Answer

An application behaves differently when running in foreground than in background because of the limitation of resources on iOS devices.

Report Error

View answer Workspace Report Error Discuss

1 2218
Q:

When is the best time to kill a foreground activity?

Answer

The foreground activity, being the most important among the other states, is only killed or terminated as a last resort, especially if it is already consuming too much memory. When a memory paging state has been reach by a foreground activity, then it is killed so that the user interface can retain its responsiveness to the user.


 

Report Error

View answer Workspace Report Error Discuss

0 2171
Q:

What is the difference between a regular bitmap and a nine-patch image?

Answer

In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.


 

Report Error

View answer Workspace Report Error Discuss

0 2138
Q:

What is the purpose of canvas in HTML?

Answer

Canvas is an element that is used for the graphics for the web page. It uses JavaScript to bring the graphics functionality live. It allows easy way to draw the graphics and use different types of tools to create drawing on the web page. Canvas is just a rectangular area that controls the pixel of every element that is used in the web page. Canvas uses methods like paths, circles, etc. The canvas element will be used as follows:


<canvas id="can" width="200" height="100"></canvas>


The canvas element includes id, width and height settings and with the javascript it gets used like:


<script type="text/javascript">


var c=document.getElementById("can");


var ctx=c.getContext("2d");


ctx.fillStyle="#FF0000";


ctx.fillRect(0,0,150,75);


</script>

Report Error

View answer Workspace Report Error Discuss

3 2134