tag:blogger.com,1999:blog-29916190873123258902024-02-08T11:37:00.333-08:00Android Interview QuestionThis is an Android Interview Question blog for BeginnersAnonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.comBlogger141125tag:blogger.com,1999:blog-2991619087312325890.post-11061783072349959162016-04-29T04:03:00.000-07:002016-04-29T04:03:20.784-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: x-large;">AsyncTask In Android </span><br />
<br />
<b><br /></b>
<b>onPreExecute(),</b> invoked on the UI thread before the task is executed.<br />
<div style="text-align: left;">
This step is normally used to setup the task, for instance by showing a progress bar in the user interface.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>doInBackground(Params...),</b> invoked on the background thread immediately after onPreExecute() finishes executing.</div>
<div style="text-align: left;">
This step is used to perform background computation that can take a long time.</div>
<div style="text-align: left;">
The parameters of the asynchronous task are passed to this step.</div>
<div style="text-align: left;">
The result of the computation must be returned by this step and will be passed back to the last step.</div>
<div style="text-align: left;">
This step can also use publishProgress(Progress...) to publish one or more units of progress. </div>
<div style="text-align: left;">
These values are published on the UI thread, in the onProgressUpdate(Progress...) step.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>onProgressUpdate(Progress...),</b> invoked on the UI thread after a call to publishProgress(Progress...). </div>
<div style="text-align: left;">
The timing of the execution is undefined. This method is used to display any form of progress in the user interface while the background computation is still executing. </div>
<div style="text-align: left;">
For instance, it can be used to animate a progress bar or show logs in a text field.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>onPostExecute(Result),</b> invoked on the UI thread after the background computation finishes. </div>
<div style="text-align: left;">
The result of the background computation is passed to this step as a parameter.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-50605866142223147662016-04-28T04:56:00.000-07:002016-04-28T04:57:13.286-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 itemprop="name" style="background-color: white; border: 0px; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 22px; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px;">
<a class="question-hyperlink" href="http://stackoverflow.com/questions/26728651/recyclerview-vs-listview" style="border: 0px; color: #242729; cursor: pointer; font-size: 24px; font-weight: normal; line-height: 1.35; margin: 0px 0px 0.5em; padding: 0px; text-decoration: none;">RecyclerView vs. ListView</a></h1>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div class="post-text" itemprop="text" style="background-color: white; border: 0px; color: #242729; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; line-height: 1.3; margin: 0px 0px 5px; padding: 0px; width: 660px; word-wrap: break-word;">
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
With the advent of Android Lollipop, the <strong style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;">RecyclerView</strong> made its way officially. The RecyclerView is much more <strong style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;">powerful, flexible and a major enhancement over ListView</strong>. I will try to give you a detailed insight into it.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">1) ViewHolder Pattern</strong></div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
In a ListView, it was recommended to use the ViewHolder pattern but it was never a compulsion. In case of RecyclerView, this is mandatory using the <a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewHolder.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">RecyclerView.ViewHolder</a> class. This is one of the major differences between the ListView and the RecyclerView.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
It makes things a bit more complex in RecyclerView but a lot of problems that we faced in the ListView are solved efficiently.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">2) LayoutManager</strong></div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
This is another massive enhancement brought to the RecyclerView. In a ListView, the only type of view available is the vertical ListView. There is no official way to even implement a horizontal ListView.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
Now using a RecyclerView, we can have a</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
i) <a href="https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">LinearLayoutManager</a> - which supports both vertical and horizontal lists,</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
ii) <a href="https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">StaggeredLayoutManager</a> - which supports Pinterest like staggered lists,</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
iii) <a href="https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">GridLayoutManager</a> - which supports displaying grids as seen in Gallery apps.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
And the best thing is that we can do all these dynamically as we want.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">3) Item Animator</strong></div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
ListViews are lacking in support of good animations, but the RecyclerView brings a whole new dimension to it. Using the <a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">RecyclerView.ItemAnimator</a> class, animating the views becomes so much easy and intuitive.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">4) Item Decoration</strong></div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
In case of ListViews, dynamically decorating items like adding borders or dividers was never easy. But in case of RecyclerView, the <a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">RecyclerView.ItemDecorator</a> class gives huge control to the developers but makes things a bit more time consuming and complex.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">5) OnItemTouchListener</strong></div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
Intercepting item clicks on a ListView was simple, thanks to its <a href="http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">AdapterView.OnItemClickListener</a>interface. But the RecyclerView gives much more power and control to its developers by the<a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnItemTouchListener.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">RecyclerView.OnItemTouchListener</a> but it complicates things a bit for the developer.</div>
<div style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
In simple words, the RecyclerView is much more customizable than the ListView and gives a lot of control and power to its developers.</div>
<div style="font-size: 15px;">
<br /></div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-64780629432980575002016-02-09T02:36:00.000-08:002016-02-09T22:31:45.617-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 class="h1" style="background-color: white; font-family: erdana, helvetica, arial, sans-serif; font-size: 29px; font-weight: 400; line-height: 23px; margin-top: 5px;">
Difference between abstract class and interface ?</h1>
<div>
<br /></div>
<div>
<div>
1) Abstract class can have abstract and non-abstract methods.</div>
<div>
Interface can have only abstract methods.</div>
<div>
<br /></div>
<div>
2) Abstract class doesn't support multiple inheritance.</div>
<div>
Interface supports multiple inheritance.</div>
<div>
<br /></div>
<div>
3) Abstract class can have final, non-final, static and non-static variables.</div>
<div>
Interface has only static and final variables.</div>
<div>
<br /></div>
<div>
4) Abstract class can have static methods, main method and constructor.</div>
<div>
Interface can't have static methods, main method or constructor.</div>
<div>
<br /></div>
<div>
5) Abstract class can provide the implementation of interface.<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
Interface can't provide the implementation of abstract class.</div>
<div>
<br /></div>
<div>
6) The abstract keyword is used to declare abstract class.<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
The interface keyword is used to declare interface.</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-44513742108902336062016-02-02T03:02:00.000-08:002016-02-02T03:02:39.382-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 itemprop="name" style="background-color: white; border: 0px; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 22px; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px;">
<a class="question-hyperlink" href="http://stackoverflow.com/questions/7821284/how-to-stop-asynctask-thread-in-android" style="border: 0px; color: #222426; cursor: pointer; font-size: 24px; font-weight: normal; line-height: 1.35; margin: 0px 0px 0.5em; padding: 0px; text-decoration: none;">How to stop Asynctask Thread in Android ?</a></h1>
<div>
<br /></div>
<div>
<div>
if (loginTask != null && loginTask.getStatus() != AsyncTask.Status.FINISHED)</div>
<div>
{</div>
<div>
loginTask.cancel(true);</div>
<div>
}</div>
<div>
Where loginTask is object of your AsyncTask</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-43113015072877265352015-12-14T04:20:00.001-08:002016-04-20T23:59:47.439-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 itemprop="name" style="background-color: white; border: 0px; color: #222426; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px;">
<a class="question-hyperlink" href="http://stackoverflow.com/questions/7771323/what-is-the-difference-between-an-intentservice-and-a-service" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #222426; cursor: pointer; font-weight: normal; line-height: 1.35; margin: 0px 0px 0.5em; padding: 0px; text-decoration: none;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Difference between an IntentService and a Service ?</span></a></h1>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">When to use ?</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">Service</em> can be used in tasks with no UI, but shouldn't be too long. If you need to perform long tasks, you must use threads within Service.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">IntentService</em> can be used in long tasks usually with no communication to Main Thread. If communication is required, can use Main Thread handler or broadcast intents. Another case of use is when callbacks are needed (Intent triggered tasks).</span></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">How to trigger ?</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">Service</em> is triggered by calling method <code style="background-color: #eeeeee; border: 0px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">startService()</code>.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">IntentService</em> is triggered using an Intent, it spawns a new worker thread and the method <code style="background-color: #eeeeee; border: 0px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">onHandleIntent()</code> is called on this thread.</span></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Triggered From</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">Service</em> and <em style="border: 0px; margin: 0px; padding: 0px;">IntentService</em> may be triggered from any thread, activity or other application component.</span></div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Runs On</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">Service</em> runs in background but it runs on the Main Thread of the application.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">IntentService</em> runs on a separate worker thread.</span></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Limitations / Drawbacks</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">Service</em> may block the Main Thread of the application.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border: 0px; margin: 0px; padding: 0px;">IntentService</em> cannot run tasks in parallel. Hence all the consecutive intents will go into the message queue for the worker thread and will execute sequentially.</span></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">When to stop?</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">If you implement a <em style="border: 0px; margin: 0px; padding: 0px;">Service</em>, it is your responsibility to stop the service when its work is done, by calling <code style="background-color: #eeeeee; border: 0px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">stopSelf()</code> or <code style="background-color: #eeeeee; border: 0px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">stopService()</code>. (If you only want to provide binding, you don't need to implement this method).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The <em style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;">IntentService</em> stops the service after all start requests have been handled, so you never have to call <code style="background-color: #eeeeee; border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">stopSelf()</code><span style="font-size: 15px;">.</span></span></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-36084076130273780162015-09-08T03:08:00.002-07:002015-09-08T03:08:50.594-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; line-height: 20.79px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What is portable wi-fi hotspot?</span></span><br />
<span style="background-color: white; line-height: 20.79px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span></span>
<span style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; line-height: 20.79px;">Portable Wi-Fi Hotspot allows you to share your mobile internet connection to other wireless device. For examples, using your Android-powered phone as a Wi-Fi Hotspot, you can use your laptop to connect to the Internet using that access-point.</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-75220766655614629462015-09-08T03:07:00.000-07:002015-09-08T03:07:04.079-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; line-height: 20.79px;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What is the difference between a regular bitmap and a nine-patch images?</span></span><br />
<span style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; line-height: 20.79px;"><br /></span>
<span style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; line-height: 20.79px;">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</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-56901502787981839472015-09-08T02:55:00.001-07:002015-09-08T03:04:28.034-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">How to store images of an activity into android phone gallery?</span></span><br />
<span style="background-color: white; white-space: pre-wrap;"><span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span></span>
<span style="background-color: white; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;"> </span><span style="background-color: white; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;">MediaStore.Images.Media.insertImage(getContentResolver(),</span><br />
<span style="background-color: white; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;"> yourBitmap,yourTitle,yourDescription);</span><br />
<div style="text-align: left;">
<span style="background-color: white;"><span style="font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;"><br /></span>
<span style="font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;"> ContentValues values = new ContentValues();
values.put(Images.Media.DATE_TAKEN, System.currentTimeMillis());
values.put(Images.Media.MIME_TYPE, "image/jpeg");
values.put(MediaStore.MediaColumns.DATA, filePath);
context.getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI, values);</span></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-80638392113635696052015-09-08T02:49:00.000-07:002015-09-08T02:49:27.965-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What is the base class for any android application?</span><br />
<span style="background-color: white; color: #222222; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;"><br /></span>
<span style="background-color: white; color: #222222; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; white-space: pre-wrap;">Application</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-4188186914726090252015-08-03T05:30:00.001-07:002015-08-03T05:30:37.623-07:00REST vs SOAP<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<br /></div>
SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer.<div>
<br />SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style.<br />
<br />
SOAP has a standard specification but there is none for REST.<br />
<br />
Whole of the web works based on REST style architecture. Consider a shared resource repository and consumers access the resources.<br />
<br />
Even SOAP based web services can be implemented in RESTful style. REST is a concept that does not tie with any protocols.<br />
<br />
SOAP is distributed computing style and REST is web style (web is also a distributed computing model).<br />
<br />
REST messages should be self-contained and should help consumer in controlling the interaction between provider and consumer(example, links in message to decide the next course of action). But SOAP doesn’t has any such requirements.<br />
<br />
REST does not enforces message format as XML or JSON or etc. But SOAP is XML based message protocol.<br />
<br />
REST follows stateless model. SOAP has specifications for stateful implementation as well.<br />
<br />
SOAP is strongly typed, has strict specification for every part of implementation. But REST gives the concept and less restrictive about the implementation.<br />
<br />
Therefore REST based implementation is simple compared to SOAP and consumer understanding.<br />
<br />
SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.<br />
<br />
SOAP has a set of standard specifications. WS-Security is the specification for security in the implementation. It is a detailed standard providing rules for security in application implementation. Like this we have separate specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS.<br />
<br />
Above all both SOAP and REST depends on design and implementation of the application.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-37144500786052572072015-08-03T03:59:00.000-07:002016-04-21T00:28:53.834-07:00Pass ArrayList From OneActivity to AnotherActivity <div dir="ltr" style="text-align: left;" trbidi="on">
<pre style="background-color: white;"><span style="color: navy;"> </span>public class DataWrapper implements Serializable </pre>
<pre style="background-color: white;"> {
private ArrayList<String> arrayList;
public DataWrapper(ArrayList<String> data)
{
this.arrayList = data;
}
public ArrayList<String> getArrayList()
{
return this.arrayList;
}
}
Intent intent = new Intent(SubCat1Activity.this,Full1Activity.class);
intent.putExtra("data",new DataWrapper(MainData));
startActivity(intent);
DataWrapper dw = (DataWrapper) getIntent().getSerializableExtra("data");
ArrayList<String> list = dw.getArrayList();</pre>
</div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-37765822003316531092015-02-06T02:16:00.002-08:002015-08-03T03:57:30.904-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">How many application tag we can add in manifest ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">As many user wants</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-63437054416249839882015-02-06T02:15:00.001-08:002015-02-06T02:15:32.074-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Which method is called when the user leaves the activity ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">onPause</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-92229183713574972542015-02-06T02:14:00.000-08:002015-02-06T02:14:26.386-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Which built-in database is Android have ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">SQLite</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-90498161659838977532015-02-06T02:13:00.000-08:002015-02-06T02:13:14.075-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Which are must required folders in the android application ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">src & res</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-29427741375117724082015-02-06T02:11:00.003-08:002015-02-06T02:11:46.799-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What is the default permission for external storage files ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Public</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-73361812070062217372015-02-06T02:10:00.004-08:002015-02-06T02:10:52.522-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What does .apk extension stand for ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Application Package kit</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-75506134108521322572015-02-06T02:09:00.002-08:002015-02-06T02:09:50.474-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">What are the different launch configurations for Android ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Run and debug</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-19815834350591858212015-02-06T02:08:00.002-08:002015-02-06T02:08:49.139-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">To log messages from your app to LogCat you should use ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">android.util.Log</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-58136980612395456172015-02-06T02:07:00.003-08:002015-02-06T02:07:20.226-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">The root element of AndroidManifest.xml is ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">manifest</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-60546896479151465292015-02-06T02:06:00.002-08:002015-02-06T02:06:23.171-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">The basic building element of Android's user interface is called ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">View</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-38629744419517012182015-02-06T02:05:00.002-08:002015-02-06T02:05:25.891-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Stores private primitive data in key-value pairs ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Shared Preferences</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-45162830908412705652015-02-06T02:04:00.000-08:002015-02-06T02:04:22.175-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Specify the directory name where the XML layout files are stored ?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">/res/layout</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-9392708829861461682015-02-05T04:58:00.000-08:002015-02-05T04:58:03.180-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">the method used to access a view element of a layout resource in an activity</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">findViewById()</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0tag:blogger.com,1999:blog-2991619087312325890.post-83573353628380132482015-02-05T04:57:00.000-08:002015-02-05T04:57:01.910-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;">a mandatory attribute for any view inside of a containing layout manager</span><br />
<span style="font-family: Arial, Helvetica, sans-serif; font-size: large;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">layout_width</span></div>
Anonymoushttp://www.blogger.com/profile/16463538658489604756noreply@blogger.com0