Skip to content

Instantly share code, notes, and snippets.

1. Async task is a helper class used for doing background work in separate thread and post the result back to the UI thread .
2. It has 3 generics as input, params, progress,result
3. 4 methods onPreExecute(), doInBackground(),onProgressUpdate(),onPostExecute()
4. UI thread should start execute method.
5. Async task can be cancelled at any point of time. onCancelled () will be called if its cancelled. And we can check isCancelled and exit the doInbackground method()
6. This is not used for very long running operations.
7. It can be used for short background operations typpically for few seconds.
study about
1. activity is a screen displayed to the user with the user interface controls
2. an application will consist many activity but atleast one will be main to start with
3. it has following life cycle
oncreate -> onstart/onrestarted -> onresume -> onpause -> onstop -> ondestroy
for more questions explain on life cycle and back stack
oncreate
-is called when the activity is creataed
1. it is used for background proces such as downloading a file.
2. it does not need user interface
3. for writing a service we need to extend the base service class provided by android
it is two kind:
1. service started
2. service bound
lifeCycle:
start service :
Intent
- is a messaging object with in the app components
- used to invoke any component from any other app components
- can carry small amount of information along with that for the invoking component to act upon it
type:
Expicit - when the optional argument which is qualified class name is given to an intent, it becomes the explicit intent
Implicit - when the action, data and mime type, category is given the android OS searches all the other apps intent filters for the given action, data and mime type , category to match the intent to invoke. if there are many options are available then the chooser is given to the user to select the appropriate one.
Let’s see how to install PostgreSQL 9.3 Server and PGAdmin3 on a clean Ubuntu OS in detail!
Install dependency
Open Terminal and execute the following commands:
sudo apt-get update
sudo apt-get -y install python-software-properties
Add PostgreSQL 9.3 repository
Before installing PostgreSQL 9.3, we have to add the PostgreSQL repository where the packages are located.
sudo -u postgres psql
ALTER USER postgres PASSWORD 'newPassword'
@rajbharath
rajbharath / designer.html
Created November 27, 2014 14:47
designer
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@rajbharath
rajbharath / psaux
Created May 30, 2015 12:17
ps shell command
ps aux | grep sublime | awk '{ print $2 }'
@rajbharath
rajbharath / sidekiq with redis in heroku
Last active August 29, 2015 14:22
Redis heroku config
heroku config:set REDIS_PROVIDER=REDISTOGO_URL
Sidekiq will automatically use it.
Also create a config/initializers/redis.rb and put the below content
if ENV["REDISCLOUD_URL"]
$redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end
@rajbharath
rajbharath / Postman UUID
Created June 26, 2015 13:11
How to create UUID in postman rest client
{{$guid}}
the above variable will generate UUID in Postman Rest Client
Sample request is below
========================
{
"user":{
"id":"{{$guid}}"
}