Sunday 26 July 2015


CalendarView in Activity


In this example we have created three java class and two xml files such as Utility.class, CalendarView.class, CalendarAdapter.class and xml is calendar.xml, calendar_item.xml . 

CalendarAdapter.class

package com.examples.android.calendar;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CalendarAdapter extends BaseAdapter {
private Context mContext;

private java.util.Calendar month;
public GregorianCalendar pmonth; // calendar instance for previous month
/**
* calendar instance for previous month for getting complete view
*/
public GregorianCalendar pmonthmaxset;
private GregorianCalendar selectedDate;
int firstDay;
int maxWeeknumber;
int maxP;
int calMaxP;
int lastWeekDay;
int leftDays;
int mnthlength;
String itemvalue, curentDateString;
DateFormat df;

private ArrayList<String> items;
public static List<String> dayString;
private View previousView;

public CalendarAdapter(Context c, GregorianCalendar monthCalendar) {
CalendarAdapter.dayString = new ArrayList<String>();
Locale.setDefault(Locale.US);
month = monthCalendar;
selectedDate = (GregorianCalendar) monthCalendar.clone();
mContext = c;
month.set(GregorianCalendar.DAY_OF_MONTH, 1);
this.items = new ArrayList<String>();
df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
curentDateString = df.format(selectedDate.getTime());
refreshDays();
}

public void setItems(ArrayList<String> items) {
for (int i = 0; i != items.size(); i++) {
if (items.get(i).length() == 1) {
items.set(i, "0" + items.get(i));
}
}
this.items = items;
}

public int getCount() {
return dayString.size();
}

public Object getItem(int position) {
return dayString.get(position);
}

public long getItemId(int position) {
return 0;
}

// create a new view for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
TextView dayView;
if (convertView == null) { // if it's not recycled, initialize some
// attributes
LayoutInflater vi = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.calendar_item, null);

}
dayView = (TextView) v.findViewById(R.id.date);
// separates daystring into parts.
String[] separatedTime = dayString.get(position).split("-");
// taking last part of date. ie; 2 from 2012-12-02
String gridvalue = separatedTime[2].replaceFirst("^0*", "");
// checking whether the day is in current month or not.
if ((Integer.parseInt(gridvalue) > 1) && (position < firstDay)) {
// setting offdays to white color.
dayView.setTextColor(Color.WHITE);
dayView.setClickable(false);
dayView.setFocusable(false);
} else if ((Integer.parseInt(gridvalue) < 7) && (position > 28)) {
dayView.setTextColor(Color.WHITE);
dayView.setClickable(false);
dayView.setFocusable(false);
} else {
// setting curent month's days in blue color.
dayView.setTextColor(Color.BLUE);
}

if (dayString.get(position).equals(curentDateString)) {
setSelected(v);
previousView = v;
} else {
v.setBackgroundResource(R.drawable.list_item_background);
}
dayView.setText(gridvalue);

// create date string for comparison
String date = dayString.get(position);

if (date.length() == 1) {
date = "0" + date;
}
String monthStr = "" + (month.get(GregorianCalendar.MONTH) + 1);
if (monthStr.length() == 1) {
monthStr = "0" + monthStr;
}

// show icon if date is not empty and it exists in the items array
ImageView iw = (ImageView) v.findViewById(R.id.date_icon);
if (date.length() > 0 && items != null && items.contains(date)) {
iw.setVisibility(View.VISIBLE);
} else {
iw.setVisibility(View.INVISIBLE);
}
return v;
}

public View setSelected(View view) {
if (previousView != null) {
previousView.setBackgroundResource(R.drawable.list_item_background);
}
previousView = view;
view.setBackgroundResource(R.drawable.calendar_cel_selectl);
return view;
}

public void refreshDays() {
// clear items
items.clear();
dayString.clear();
Locale.setDefault(Locale.US);
pmonth = (GregorianCalendar) month.clone();
// month start day. ie; sun, mon, etc
firstDay = month.get(GregorianCalendar.DAY_OF_WEEK);
// finding number of weeks in current month.
maxWeeknumber = month.getActualMaximum(GregorianCalendar.WEEK_OF_MONTH);
// allocating maximum row number for the gridview.
mnthlength = maxWeeknumber * 7;
maxP = getMaxP(); // previous month maximum day 31,30....
calMaxP = maxP - (firstDay - 1);// calendar offday starting 24,25 ...
/**
* Calendar instance for getting a complete gridview including the three
* month's (previous,current,next) dates.
*/
pmonthmaxset = (GregorianCalendar) pmonth.clone();
/**
* setting the start date as previous month's required date.
*/
pmonthmaxset.set(GregorianCalendar.DAY_OF_MONTH, calMaxP + 1);

/**
* filling calendar gridview.
*/
for (int n = 0; n < mnthlength; n++) {

itemvalue = df.format(pmonthmaxset.getTime());
pmonthmaxset.add(GregorianCalendar.DATE, 1);
dayString.add(itemvalue);

}
}

private int getMaxP() {
int maxP;
if (month.get(GregorianCalendar.MONTH) == month
.getActualMinimum(GregorianCalendar.MONTH)) {
pmonth.set((month.get(GregorianCalendar.YEAR) - 1),
month.getActualMaximum(GregorianCalendar.MONTH), 1);
} else {
pmonth.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) - 1);
}
maxP = pmonth.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);

return maxP;
}

}




CalendarView.class



package com.examples.android.calendar;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.Locale;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class CalendarView extends Activity {

public GregorianCalendar month, itemmonth;// calendar instances.

public CalendarAdapter adapter;// adapter instance
public Handler handler;// for grabbing some event values for showing the dot
// marker.
public ArrayList<String> items; // container to store calendar items which
// needs showing the event marker
ArrayList<String> event;
LinearLayout rLayout;
ArrayList<String> date;
ArrayList<String> desc;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.calendar);
Locale.setDefault(Locale.US);

rLayout = (LinearLayout) findViewById(R.id.text);
month = (GregorianCalendar) GregorianCalendar.getInstance();
itemmonth = (GregorianCalendar) month.clone();

items = new ArrayList<String>();

adapter = new CalendarAdapter(this, month);

GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(adapter);

handler = new Handler();
handler.post(calendarUpdater);

TextView title = (TextView) findViewById(R.id.title);
title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));

RelativeLayout previous = (RelativeLayout) findViewById(R.id.previous);

previous.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
setPreviousMonth();
refreshCalendar();
}
});

RelativeLayout next = (RelativeLayout) findViewById(R.id.next);
next.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
setNextMonth();
refreshCalendar();

}
});

gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
// removing the previous view if added
if (((LinearLayout) rLayout).getChildCount() > 0) {
((LinearLayout) rLayout).removeAllViews();
}
desc = new ArrayList<String>();
date = new ArrayList<String>();
((CalendarAdapter) parent.getAdapter()).setSelected(v);
String selectedGridDate = CalendarAdapter.dayString
.get(position);
String[] separatedTime = selectedGridDate.split("-");
String gridvalueString = separatedTime[2].replaceFirst("^0*",
"");// taking last part of date. ie; 2 from 2012-12-02.
int gridvalue = Integer.parseInt(gridvalueString);
// navigate to next or previous month on clicking offdays.
if ((gridvalue > 10) && (position < 8)) {
setPreviousMonth();
refreshCalendar();
} else if ((gridvalue < 7) && (position > 28)) {
setNextMonth();
refreshCalendar();
}
((CalendarAdapter) parent.getAdapter()).setSelected(v);

for (int i = 0; i < Utility.startDates.size(); i++) {
if (Utility.startDates.get(i).equals(selectedGridDate)) {
desc.add(Utility.nameOfEvent.get(i));
}
}

if (desc.size() > 0) {
for (int i = 0; i < desc.size(); i++) {
TextView rowTextView = new TextView(CalendarView.this);

// set some properties of rowTextView or something
rowTextView.setText("Event:" + desc.get(i));
rowTextView.setTextColor(Color.BLACK);

// add the textview to the linearlayout
rLayout.addView(rowTextView);

}

}

desc = null;

}

});
}

protected void setNextMonth() {
if (month.get(GregorianCalendar.MONTH) == month
.getActualMaximum(GregorianCalendar.MONTH)) {
month.set((month.get(GregorianCalendar.YEAR) + 1),
month.getActualMinimum(GregorianCalendar.MONTH), 1);
} else {
month.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) + 1);
}

}

protected void setPreviousMonth() {
if (month.get(GregorianCalendar.MONTH) == month
.getActualMinimum(GregorianCalendar.MONTH)) {
month.set((month.get(GregorianCalendar.YEAR) - 1),
month.getActualMaximum(GregorianCalendar.MONTH), 1);
} else {
month.set(GregorianCalendar.MONTH,
month.get(GregorianCalendar.MONTH) - 1);
}

}

protected void showToast(String string) {
Toast.makeText(this, string, Toast.LENGTH_SHORT).show();

}

public void refreshCalendar() {
TextView title = (TextView) findViewById(R.id.title);

adapter.refreshDays();
adapter.notifyDataSetChanged();
handler.post(calendarUpdater); // generate some calendar items

title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
}

public Runnable calendarUpdater = new Runnable() {

@Override
public void run() {
items.clear();

// Print dates of the current week
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String itemvalue;
event = Utility.readCalendarEvent(CalendarView.this);
Log.d("=====Event====", event.toString());
Log.d("=====Date ARRAY====", Utility.startDates.toString());

for (int i = 0; i < Utility.startDates.size(); i++) {
itemvalue = df.format(itemmonth.getTime());
itemmonth.add(GregorianCalendar.DATE, 1);
items.add(Utility.startDates.get(i).toString());
}
adapter.setItems(items);
adapter.notifyDataSetChanged();
}
};
}


Utility.class


package com.examples.android.calendar;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class Utility {
public static ArrayList<String> nameOfEvent = new ArrayList<String>();
public static ArrayList<String> startDates = new ArrayList<String>();
public static ArrayList<String> endDates = new ArrayList<String>();
public static ArrayList<String> descriptions = new ArrayList<String>();

public static ArrayList<String> readCalendarEvent(Context context) {
Cursor cursor = context.getContentResolver()
.query(Uri.parse("content://com.android.calendar/events"),
new String[] { "calendar_id", "title", "description",
"dtstart", "dtend", "eventLocation" }, null,
null, null);
cursor.moveToFirst();
// fetching calendars name
String CNames[] = new String[cursor.getCount()];

// fetching calendars id
nameOfEvent.clear();
startDates.clear();
endDates.clear();
descriptions.clear();
for (int i = 0; i < CNames.length; i++) {

nameOfEvent.add(cursor.getString(1));
startDates.add(getDate(Long.parseLong(cursor.getString(3))));
endDates.add(getDate(Long.parseLong(cursor.getString(4))));
descriptions.add(cursor.getString(2));
CNames[i] = cursor.getString(1);
cursor.moveToNext();

}
return nameOfEvent;
}

public static String getDate(long milliSeconds) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliSeconds);
return formatter.format(calendar.getTime());
}
}


calendar_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/calendar_cell"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="2dip" >

    <TextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#0000D7"
        android:textSize="14dip"
        android:textStyle="bold" >
    </TextView>

    <ImageView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/date_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/date"
        android:src="@drawable/dot"
        android:visibility="gone" />

</LinearLayout>

calendar.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/calendar_top" >

        <RelativeLayout
            android:id="@+id/previous"
            android:layout_width="40dip"
            android:layout_height="30dip"
            android:layout_alignParentLeft="true" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:background="@drawable/arrow_left" />
        </RelativeLayout>

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="5dip"
            android:textColor="#000000"
            android:textSize="18dip"
            android:textStyle="bold" />

        <RelativeLayout
            android:id="@+id/next"
            android:layout_width="40dip"
            android:layout_height="30dip"
            android:layout_alignParentRight="true" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:background="@drawable/arrow_right" />
        </RelativeLayout>
    </RelativeLayout>

    <GridView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/gridview"
        android:layout_below="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:listSelector="@android:color/transparent"
        android:numColumns="7"
        android:stretchMode="columnWidth" />
    
    <LinearLayout 
        android:id="@+id/text"
        android:layout_below="@+id/gridview"
        android:layout_width="match_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <!-- <TextView 
           android:id="@+id/tvView"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:visibility="gone"
           android:text=""/> -->
    </LinearLayout>

</RelativeLayout>


In AndroidManifest to give two permission that is  
<uses-permission android:name="android.permission.READ_CALENDAR"/>
 <uses-permission android:name="android.permission.WRITE_CALENDAR"/>





Tuesday 14 July 2015

Marquee in android


Marquee in Android


In xml file you enter the this code:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/mywidget"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:lines="1"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:textColor="#ff4500"
        android:singleLine="true"
        android:text="Simple application that shows how to use marquee, with a long text" />
</RelativeLayout>

In java file you enter this code:

textView =(TextView) rootView.findViewById(R.id.mywidget);
 textView.setSelected(true);

Wednesday 11 March 2015

Android Login Screen Tutorial





DBAdapter.java:-
package com.my.members;
import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.Cursor;
public class DBAdapter
import android.database.sqlite.SQLiteDatabase; {
public static final String KEY_ROW_ID = "_id";
private static final String DATABASE_TABLE = "members";
public static final String KEY_PASSWORD = "password";
public static final String KEY_USERNAME = "username"; SQLiteDatabase mDb; Context mCtx;
public DBAdapter open() throws SQLException
DBHelper mDbHelper; public DBAdapter(Context context) { this.mCtx = context; } {
{
mDbHelper = new DBHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; } public void close()
ContentValues initialValues = new ContentValues();
mDbHelper.close(); } public long register(String user,String pw) { initialValues.put(KEY_USERNAME, user);
public boolean Login(String username, String password) throws SQLException
initialValues.put(KEY_PASSWORD, pw); return mDb.insert(DATABASE_TABLE, null, initialValues); } {
if (mCursor != null) {
Cursor mCursor = mDb.rawQuery("SELECT * FROM " + DATABASE_TABLE + " WHERE username=? AND password=?", new String[]{username,password}); if(mCursor.getCount() > 0) { return true; } }
}
return false;
}
DBHelper.java:-
package com.my.members;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
private static final String DATABASE_NAME = "membersdb";
public class DBHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1;
private static final String DATABASE_CREATE = "CREATE TABLE (_id integer primary key autoincrement,username text not null,password text not null);";
public DBHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } @Override
}
public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) { db.execSQL("DROP TABLE IF EXISTS members"); onCreate(db); }
MemberActivity.java:-
package com.my.members;
import android.app.Activity;
import android.content.Context;
import android.database.SQLException;
import android.os.Bundle;
import android.view.View;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import android.view.View.OnClickListener;
import android.widget.Toast;
import android.widget.Button; import android.widget.EditText;
EditText txtUserName;
public class MembersActivity extends Activity { DBAdapter dbAdapter; EditText txtPassword; Button btnLogin;
super.onCreate(savedInstanceState);
Button btnRegister; @Override public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.main);
btnLogin = (Button) findViewById(R.id.btn_login);
txtUserName = (EditText) findViewById(R.id.et_user); txtPassword = (EditText) findViewById(R.id.et_pw); btnRegister = (Button) findViewById(R.id.btn_reg);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
dbAdapter = new DBAdapter(this); dbAdapter.open(); btnLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) {
String password = txtPassword.getText().toString();
imm.hideSoftInputFromWindow(txtUserName.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtPassword.getWindowToken(), 0); String username = txtUserName.getText().toString();
.show();
if (username.length() > 0 && password.length() > 0) { try { if (dbAdapter.Login(username, password)) { Toast.makeText(MembersActivity.this, "Successfully Logged In", Toast.LENGTH_LONG) } else {
Toast.LENGTH_LONG).show();
Toast.makeText(MembersActivity.this, "Invalid username or password", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(MembersActivity.this, "Some problem occurred", } } else {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Toast.makeText(MembersActivity.this, "Username or Password is empty", Toast.LENGTH_LONG).show(); } } }); btnRegister.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) {
long i = dbAdapter.register(username, password);
imm.hideSoftInputFromWindow(txtUserName.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtPassword.getWindowToken(), 0); try { String username = txtUserName.getText().toString(); String password = txtPassword.getText().toString(); if(i != -1)
}
Toast.makeText(MembersActivity.this, "You have successfully registered",Toast.LENGTH_LONG).show(); } catch (SQLException e) { Toast.makeText(MembersActivity.this, "Some problem occurred", Toast.LENGTH_LONG).show(); } } });
}
main.xml:-
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:textSize="40dp" android:layout_gravity="right" android:layout_marginBottom="10dp" android:layout_marginLeft="30dp"/> <TableLayout android:id="@+id/tableLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" > </TableRow> <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <EditText android:id="@+id/et_user" android:layout_width="wrap_content" android:layout_height="wrap_content" android:width="250dp" android:layout_marginLeft="30dp" android:layout_marginBottom="10dp" android:hint="@string/u"> <requestFocus /> </EditText> </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content" > <EditText android:id="@+id/et_pw" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPassword" android:layout_marginLeft="30dp" android:layout_marginBottom="10dp" android:hint="@string/p"/> </TableRow> <TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/btn_login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/l" android:layout_marginLeft="30dp" android:layout_marginBottom="10dp" android:textSize="20dp"/> </TableRow> <TableRow android:id="@+id/tableRow5" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/btn_reg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/r" android:layout_marginLeft="30dp" android:layout_marginBottom="10dp" android:textSize="20dp"/> </TableRow> </TableLayout> </LinearLayout>

Sunday 8 March 2015

What is Android ???


Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google. 

Platform usage in Android


Charts in this section provide breakdowns of Android versions, based on the devices accessing the Play Store in a seven-day period ending on March 2, 2015. Therefore, these statistics exclude Android forks that do not access Google Play, such as Amazon's Fire tablets.

VersionCode nameRelease dateAPI levelDistribution
2.2FroyoMay 20, 201080.4%
2.3.3–2.3.7GingerbreadFebruary 9, 2011106.9%
4.0.3–4.0.4Ice Cream SandwichDecember 16, 2011155.9%
4.1.xJelly BeanJuly 9, 20121617.3%
4.2.xJelly BeanNovember 13, 20121719.4%
4.3Jelly BeanJuly 24, 2013185.9%
4.4KitKatOctober 31, 20131940.9%
5.0LollipopNovember 3, 2014213.3%
VersionCode nameRelease dateAPI levelDistribution
5.0LollipopNovember 3, 2014213.3%
4.4KitKatOctober 31, 20131940.9%
4.3Jelly BeanJuly 24, 2013185.9%
4.2.xNovember 13, 20121719.4%
4.1.xJuly 9, 20121617.3%
4.0.3–4.0.4Ice Cream SandwichDecember 16, 2011155.9%
2.3.3–2.3.7GingerbreadFebruary 9, 2011106.9%
2.2FroyoMay 20, 201080.4%

Wednesday 18 February 2015

           

Apple Car: Please, Mr. Cook, Think Different

     
                             Apple Car: Please, Mr. Cook, Think Different





















It's tempting to imagine Apple getting into the car business. How tempting? A Wall Street Journal article speculating that the company might do so because it has hired many car industry veterans became the (latest) focal point for a lively discussion on the pros and cons. USA Today threw some cold water on the report by heavily quoting analyst Tim Bajarin, who thinks that buying — Tesla, that is — would be smarter than building, and that, anyway, this is more a play for the dashboard, a CarPlay on steroids, than an opportunity for Tim Cook to channel his inner Elon Musk.
Could Apple get into the act? That one is easy. No company is better positioned in market capitalization and available cash to do, frankly, whatever it wants. Apple is still minting money with the iPhone. Smartphones have only just outsold feature phones globally and Apple has only just begun to tap the massive China market. History may be repeating itself in Japan, which gave up the gun to extend the era of the samurai, but that nation's fascination with feature versus smart phones is an outlier. Smartphones are eating the world.
But when a company is as dependant as Apple is on a single product — and even when it isn't — it's smart to think about what else it can get into. Google is today's big tech poster child for the need to diversify; it is still making a fortune on ad revenue but its business model is based mastery of the web. In mobile — where we are all going — Facebook seems to be doing a better job of conquering the market.
Apple has been associated with car talk for years. Fascination with an Apple Car was almost a death bed confession from Steve Jobs himself, who, in one of his final interviews, told the New York Times he would have wanted to take on Detroit if he "had more energy." Sightings of unmarked, self-driving minivans, at least some of which registered to Apple, have proliferated lately, fuelling speculation that Apple is interested in pulling a Musk. Even better: kicking the tires sticks it to arch-rival Google, which has a mature self-driving program as well as aspirations to be theoperating system of your car.
So is this about Apple Car or Apple cars? The company's DNA may provide the key clues.
Apple seeks to corner markets while staying true to itself. When Steve Jobs returned to Apple in the late 1990s, he put an end to Mac OS cloning, inextricably pairing hardware and software and gaining control over the finished product as no other company can.
Apple followed this playbook with its entire line of iDevices, from the iPod to the iPad, all top sellers in their categories. In music Apple still thinks grandly: Shirley Halperin and Ed Christman report in Billboard that the company wants to "own the record industry."
Can Apple claim a space in the car industry? Maybe. All of Tesla's patents are open source, so it could go a long way alone. But if Tesla were for sale — and even if it weren't, for that matter — Apple could get a running start by purchasing the company for cash, even if you included a goodwill premium which doubled the company's market cap. Relocate the Apple Car division to Ireland and the company might even be able to repatriate a ton of cash with a novel form of tax inversion. All sound high-level business reasons to go down that road.
There's more: Cars are basically eye candy, sold by how they are look and feel. That's a major Apple strength. New models come out every year with incremental changes you can see and major upgrades under the hood. Just like iPhones.
It all sounds so … tempting.
But Apple may be better, this time, backing every horse instead of its own. The battle for the car, like the battle for the living room, is about what's loosely called the "Internet of Things (IoT)." It's about muscling in with hub-like device which connects and controls other things. Like a smartphone.
Apple has already introduced CarPlay, which gets its nose into the tent. Wouldn't licensing lightening connectors and a version of iOS in every car — cashing a check — be smarter than overcoming the barriers to entry for an industry where billions are needed to get to the start line? Wouldn't licensing an "Apple Edition" with one or more manufacturers be an effective way of owning the part of the car you want, and not the parts you don't? (Similar to how Apple dipped its toe into mobile phones before launching the iPhone.) Wouldn't limiting the innovation required to a component you completely control be more elegant and manageable than the whole, unwieldy beast? Wouldn't being the brains be enough to take credit for every car which contains yours?
Turning the iPhone into an enabler of tech moves its paradigm into the nascent IoT space. It's a way of extending the strength of a powerful revenue engine without reinventing the wheel. Diversifying the iPhone could be Apple's Next Big Thing, not a big thing on wheels.
Tim Cook is no fool. He believes in big bets, but not blind ones. Neither EV or self-driving cars are mainstream and it isn't clear that either ever will be. But Apple can power and enhance that tech without getting mired in a business with fierce, experienced, successful competition. Apple is winning the mobile wars because the competition was feckless or non-existent or unimaginative. That is decidedly not a description of the car industry.
An Apple Car — something which the company makes and markets as it would a MacBook Air — seems highly unlikely. There's no obvious roadmap to any of the forms of world domination which motivates Apple. More to the point: it's not Think Different. It's almost the lazy me-tooism that drives critics who give Apple no credit whatsoever for innovation absolutely nuts.
Do you think Apple should be in the car business? If so, how?