Translate

Friday, 14 September 2012

Facebook Web Search Coming Soon?


             The web is all about the queries and the results. For all those who like to spend most of the time on internet,surfing and searching  Google, you might get a new search engine soon. Now it seems like competition in search engines is now growing and we now might see a new competitor soon.
Recently, Mark Zuckerberg, the founder of famous social website Facebook indicated that the users might see a new web search engine developed by them. According to him, people are already using the Facebook search feature to find the social details of others and they are handling lots of queries daily. He also added saying that, they have a team of people working on developing the so called Facebook Search Engine, and at some point they will do it.



             According to him, there is something that Google and current search engines are missing. Instead of producing a pile of results, they should correctly and aptly answer a query just by proving a specific answer to a specific query made.
              So if we are to see this new Facebook SE, we should expect some major change how the search engines have been working till now. It won’t be wrong either to expect a major difference between Google and Facebook SEs. At least there is one thing that is clear, with all the info Facebook already has, they should not find it difficult to establish than any other new startup.

Adapter View in Android with Example

 What is Adapter in android??
               In android we cannot directly put any data into List View. So that we required adapter, which is act as mediator between data and listview. So first we take data into simple ListArray then pass it to adapter and then this adapter is set to List view.
 ----------------------------------------------------------------------------------------------------------- 


package shlsh.adapter.view;

import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class AdapterViewDemoActivity extends Activity {

    ArrayList<String> listOfCountryNames;
    ArrayAdapter<String> countryAdapter;
   
    EditText edtCountry;
    Button btnAdd;
   
    ListView listView;
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
   
        listOfCountryNames = new ArrayList<String>();
       
        edtCountry = (EditText) findViewById(R.id.edtName);
       
       
        btnAdd = (Button) findViewById(R.id.btnAdd);
        btnAdd.setOnClickListener(new View.OnClickListener() {
           
            public void onClick(View v) {
               
                listOfCountryNames.add(edtCountry.getText().toString());
                countryAdapter.notifyDataSetChanged();
            }
        });
       
       
        listView = (ListView) findViewById(R.id.listView);
       
        countryAdapter = new ArrayAdapter<String>(
                this,
                android.R.layout.simple_list_item_single_choice,
                listOfCountryNames);
       
        listView.setAdapter(countryAdapter);
    }
}

OUTPUT:--------------------------------------

Android Architecture


           The Android software stack as shown in figure can be subdivided into five layers: The kernel and low level tools,  native libraries, the Android Runtime, the framework layer and on top of all the applications.

Android Architecture is categorize into layer  as well as by different meaningful color.

 RED LAYER:
                   The red layer represents the services offered by the Linux kernel and associated GNU utility packages ported to the ARM architecture. These components are licensed under the GNU [General Public License] the GPL.
-Core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.
                  

GREEN LAYER:
                   The green layer consists entirely of open source libraries available under various licenses. Some of the libraries come from the GNU project itself. The licenses here vary from the LGPL, BSD, MIT and are completely in the public domain in the case of the SQLite database. As such, any phone that would customize the libraries found in this layer, add libraries or remove them altogether would no longer be able to brand itself as an Android phone.
-Set of C/C++ libraries used by various components of the Android system.

BLUE LAYER:
                 The Blue layer, the application developer has access to what Android refers to as ‚ ‘service’ processes. These services are invisible to the user of the handset. Application developers can communicate with these services via a message bus. 

-Set of core applications including an email client, SMS program, calendar, maps, browser etc. All applications are written using the Java programming language
-Set of standard components and user services (written using the Java) which help to implement the standard structure of an application.

YELLOW LAYER:
A set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.

Thursday, 13 September 2012

Code for Android Activity Life Cycle

Here is sample code to check different activity states throughout application.
 ----------------------------------------------------------------------------------------
package sheldroid.shlsh.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class ActivitylifecycleActivity extends Activity {

    void mt(String msg) {
       
        Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        mt("On Create");
    }
   
    @Override
    protected void onStart() {
        super.onStart();
       
        mt("On Start");
    }
   
    @Override
    protected void onResume() {
        super.onResume();
       
        mt("On Resume");
    }
   
    @Override
    protected void onPause() {
        super.onPause();
       
        mt("On Pause");
    }
   
    @Override
    protected void onStop() {
        super.onStop();
       
        mt("On Stop");
    }
   
    @Override
    protected void onDestroy() {
        super.onDestroy();
       
        mt("On Destroy");
    }
   
    @Override
    protected void onRestart() {
        super.onRestart();
       
        mt("On Restart");
    }
}
-----------------------------------------------------------------------------------
Now u can simply test this application by pressing Home, Backspace  buttons.
You will see Toast messages displaying their activity states. 

Wednesday, 12 September 2012

Android Activity Life Cycle.

What is an Activity in Android?

              Activity  is one of the application component, which gives you platform to interact with widgets, views etc. Activity gives you user interface to do many task as per requirement. In application we can use many activities with different user interface and functionality. 
                   Now, we see how activity Life cycle works.


 Activity Life Cycle


Tuesday, 11 September 2012

Getting started with Android-Hello World

package my.hello.world;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class HelloWorldActivity extends Activity {
    /** Called when the activity is first created. */
    Button hello;
    TextView txt;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
       
        hello=(Button) findViewById(R.id.hello);
        txt=(TextView) findViewById(R.id.txt);
       
        hello.setOnClickListener(new OnClickListener() {
           
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
           
                txt.setText("Hello world");
               
            }
        });
             
     }
}



In above example we see that we used one TextView and one Button.
On the Button onclicklistener activity we simply set the Text as "Hello World" .