Thursday, 27 August 2015

Android Basic Question Book

No comments
Hello, 
Dear All, 

Before the question phase i want to share a bite of tips that help you at interview time:


Golden tips for a successful interview:


. Keep smiley face and occasion.

. Be clear and loud voice.
. Asks them to give the same answer.
. The answer was short and to the point.
. Do not give the wrong answer quickly.
. Try to think about the correct answer.
. Give a convincing answer.

- Interview fun experiences


Some candidates during interviews loose (nervous) is going to be. The text is also aimed at them specifically.

What about the future that will consist Remove. Keep in mind, healthy and occasion. Maintain your natural and naturalness. 

What to speak with the elders of the house that is the conversation. So it's a pleasure, enthusiasm and pomp give interviews. Leave everything else to God. It is with you and have faith that He cares for you. 

I hope,this chapter will help you.

All the very Best ... !!!!






Android Basic QA Book part:1



1) What is Android?
Answer: Android is an open-source operating system that is used in mobiles, tablets, televisions, wearable device etc.

2) Who is the founder of Android OS? witch year?
Answer: October 2003 by Andy Rubin.

3) Explain .apk extension.
Answer: APK stands for Application Package. The .apk It refers to a file type having compressed information of application code and resource files with AndroidManifest.xml file.

4) Witch language is used to develop Android?
Answer: Android is developed using Java language.

5) Explain primary components used in Android architecture?
Answer: The Android is used four essential that are (1) Linux Kernel (2) Set of libraries (3) Android Framework (4) Android Applications.

6) Explain AIDL?
Answer: AIDL stands for Android Interface Definition Language. its offers to define the client’s interface requirements & service to communicate at same level with help of inter process communications.

7) List the data types supported in AIDL?
Answer: AIDL supports all type of native java type and data types Like string, list, map etc.

8) How to android track applications?
Answer: It is done by assigning each application with a unique Linux User ID.

9) What are the advantages of android?
Answer: Open-source: It means no licence, distribution and development fee.
Platform-independent: It supports windows, mac and linux platforms.
Highly optimized Virtual Machine: Android uses highly optimized virtual machine for mobile devices, called DVM (Dalvik Virtual Machine).
Supports various technologies: It supports audio,video,camera, Bluetooth, wifi, speech, EDGE, Scanner etc. technologies.

10) Write code names of android?
Answer:
1.    Aestro
2.   Blender
3.   Cupcake
4.   Donut
5.   Eclair
6.   Froyo
7.   Gingerbread
8.   Honycomb
9.   Ice Cream Sandwitch
10. Jelly Bean
11. Kitkat
12. Lolipop
13. Marshmallow  6.0 August 17, 2015;

11) Does android support other language than java?
Answer: Yes, android developed in C/C++ also using android NDK (Native Development Kit).

12) What are the core building blocks of android?
Answer: The core building blocks of android are:
ActivityViewIntentServiceContent Provider,
Fragments,  and  AndroidManifest.xml etc.

13) What is activity?
Answer: Activity  is a pre-defined class, and also is a Java code that supports a frame or screen or UI.

14) What is AAPT?
Answer: AAPT is stand for android asset packaging tool. It handles the android packaging process.

15) Write step of life cycle methods of android activity?
Answer : There are 7 life-cycle methods of activity.
1.   onCreate()
2.   onStart()
3.   onResume()
4.   onPause()
5.   onStop()
6.   onRestart()
7.   onDestroy()

16) What is intent and use of intent?
Answer: Intent is a information that is passed to the components. It is used to launch an activity, display a web page, send sms, create call, send email etc.

17) How many types of intent?
Answer: There are two types of intents in android:
1.   Implicit Intent
2.   Explicit Intent

18) What is implicit intent in android?
Answer: Implicit intent is used to allows to component from another app. 
e.g. To know location of other users.

19) What is explicit intent in android?
Answer: Explicit intent is used to start an component in your own app.
e.g. Start new Activity.

20) What is the name of database used in android?
Answer: SQLite:  An open source and lightweight relational database for mobile devices.

21) What is fragment?
Answer: Fragment is a part of Activity. That allow to display multiple screens on single activity.

22) What is NDK?
Answer:NDK stands for Native Development Kit. We develop a part of app using native language such as C/C++ to boost the performance. it should be used with android SDK(Software Development Kit).

23) What is ADB?
Answer: ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance.

24) What is ANR?
Answer: ANR stands for Application Not Responding. It is a dialog box that appears if the application is no longer responding more then 10 seconds.

25) What is SDK?
Answer: SDK is a Software Development Kit that enables developers to create applications for the Android platform.


Thank you

Friday, 19 June 2015

Custom Listview in android -2

No comments
In this chapter we learn how to implement custom Listview in android.Listview is one of the most popular controls, It can be used in many different forms and can be customized to suitable of app requirement.In this tutorial, I will demonstrate you how you can bind a simple array of Strings with ListView. 
May You Want To See Another Examples Of How To Create Simple Listview Part-1 and Part-2
Customlistview with same image Part-1
In this example we set a different image for all list items.

Let's go for coding:

CREATE NEW ANDROID PROJECT


We need for this example:

1) activity_main.xml (...res/layout/ )
2) mylist.xml (...res/layout/ )
3) MainActivity.java

4) CustomListAdapter.java

Step 1: Write code into activity_main.xml
This is a main activity where we put list view.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>

</LinearLayout>

Step 2: Write code into mylist..xml
Created custom view for listview to show with image and text in list view.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:padding="5dp" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/item"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:padding="2dp"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#0000aa" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:text="TextView" />
    </LinearLayout>

</LinearLayout>

Step 3: Write code into MainActivity.java

package dev.androidapplink.customlistviewapp_2;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity {
// create variable
ListView list;
//define string for List item(s)
String[] itemname = { "pic1", "pic2", "pic3", "pic4", "pic5", "pic6",
"pic7", "pic8" };
//set image according to list item(s) from drawable
Integer[] imgid = { R.drawable.pic1, R.drawable.pic2, R.drawable.pic3,
R.drawable.pic4, R.drawable.pic5, R.drawable.pic6, R.drawable.pic7,
R.drawable.pic8, };

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//create adapter and bind item name with image id
CustomListAdapter adapter = new CustomListAdapter(this, itemname, imgid);
list = (ListView) findViewById(R.id.list);
list.setAdapter(adapter);
//implement on item click listener to show toast on click but you can put here your operation as your requirement of app
list.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
String Slecteditem = itemname[+position];
// make your operation here i make toast.

Toast.makeText(getApplicationContext(), Slecteditem,
Toast.LENGTH_SHORT).show();

}
});
}

}

Step 4: Write code into CustomListAdapter.java
CustomListAdapter.java is a custom list adapter class which provides data to list view.
package dev.androidapplink.customlistviewapp_2;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomListAdapter extends ArrayAdapter<String> {

private final Activity context;
private final String[] itemname;
private final Integer[] imgid;

public CustomListAdapter(Activity context, String[] itemname,
Integer[] imgid) {
super(context, R.layout.mylist, itemname);
// TODO Auto-generated constructor stub

this.context = context;
this.itemname = itemname;
this.imgid = imgid;
}

public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.mylist, null, true);

TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);

txtTitle.setText(itemname[position]);
imageView.setImageResource(imgid[position]);
extratxt.setText("Description " + itemname[position]);
return rowView;
};

}
Step 5: Now Run Your Project:




Thursday, 18 June 2015

Custom Listview in android-1

1 comment
In this chapter we learn how to implement custom Listview in android.Listview is one of the most popular controls, It can be used in many different forms and can be customized to suitable of app requirement.In this tutorial, I will demonstrate you how you can bind a simple array of Strings with ListView. 
May You Want To See Another Examples Of How To Create Simple Listview Part-1 and Part-2.
Customlistview with Different image Part-2.
In this example we set a same image for all list items.

Let's go for coding:


CREATE NEW ANDROID PROJECT


We need for this example:

1) activity_main.xml (...res/layout/ )
2) mylist.xml (...res/layout/ )
3) MainActivity.java

Step 1: Write code into activity_main.xml


This is a main activity where we put list view.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <ListView
        android:id="@+id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

Step 2: Write code into mylist.xml

Created custom view for list view to show with image and text in list view.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

    <ImageView

        android:id="@+id/icon"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginBottom="4dp"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:layout_marginTop="4dp"
        android:src="@drawable/ic_launcher" />

    <TextView

        android:id="@+id/Itemname"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="4dp"
        android:textSize="18sp" />


</LinearLayout>

Step 3: Write code into MainActivity.java


package dev.androidapplink.customlistviewapp;


import android.os.Bundle;

import android.app.ListActivity;
import android.widget.ArrayAdapter;

public class MainActivity extends ListActivity {

       
         //define string for List item(s)
String[] itemname = { "Android", ".NET", "JAVA", "FireFox",
"SQlite", "Orecale", "xmp", "Database" };

@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
               
                //Bind custom list view by using ArrayAdapter
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.mylist,
R.id.Itemname, itemname));
}

}
Step 4: Now Run Your Project:


Download project:

Checkbox android example

No comments
In this example we learn about Checkbox. checkbox having a two type of states checked or unchecked.here we learn a simple example one is display result in Textview and second is display toaster.

Let's go for coding.


CREATE NEW ANDROID PROJECT


Step 1: Write code into activity_main.xml


<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:id="@+id/tvDetails"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#fff" />

    <CheckBox

        android:id="@+id/cbAALink"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="https://Androidapplink.blogspot.in" />

    <CheckBox

        android:id="@+id/cbLike"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Like" />


</LinearLayout>

Step 2: Write code into MainActivity.java


package dev.androidapplink.checkboxapp;


import android.app.Activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

// create variables
TextView tvdetail;
CheckBox cbaalink, cblikes, cbimgicn;
OnClickListener checkBoxListener;

@Override

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// load control
cbaalink = (CheckBox) findViewById(R.id.cbAALink);
cblikes = (CheckBox) findViewById(R.id.cbLike);

checkBoxListener = new OnClickListener() {


@Override

public void onClick(View v) {
tvdetail = (TextView) findViewById(R.id.tvDetails);

if (cbaalink.isChecked()) {

 
// set message
tvdetail.setText("Following:");
 
// get string of check box + set message (tvdetail.setText("Following:");)
tvdetail.setText(tvdetail.getText().toString() + " "
+ cbaalink.getText().toString());
}
if (cblikes.isChecked()) {

// set message

tvdetail.setText("Yes I Like");
 
// display toast
 Toast.makeText(getApplicationContext(), 
                              "Thank You", Toast.LENGTH_LONG).show();
}

if (!cbaalink.isChecked() && !cblikes.isChecked()) {

tvdetail.setText("Happy To Help");// display when both check box is unchecked

}

}
};

cbaalink.setOnClickListener(checkBoxListener);

cblikes.setOnClickListener(checkBoxListener);

}


}

Step 3: Now Run Your Project:







Follow me Share