Thursday, 3 August 2017

Android Testing App

Alpha Testing is conducted within organization and tested by developer/ team of developers/ testers. This testing is close for public. 

Beta testing is conducted by the end users who are not programmers, software engineers or testers. This testing may be open for public.

Closed Alpha Testing: This testing is conducted inside organization and restricted by the emails/groups. those who are added in list/groups of testers in google play store they can test app.

Opened Alpha Testing: Those who have Opt-in link of app will test app. This testing is not restricted by emails/groups. You can set numbess of testers in google play store.

Closed Beta Testing: This testing is conducted outside organization and restricted by the emails/groups. those who are added in list/groups of testers in google play store they can test app.

Opened Beta Testing: This testing is conducted outside organization and This testing is not restricted by the emails/groups. This testing is conducted in real time or **live environment**. **App will be live in store and users can install it.  Its open for public**. You can set numbers of testers in google play store.

Generally, Alpha test takes place first, Testing is done by developers or testers within organization, then it goes to Beta testing outside the organization, non technical or end users will conduct test.Beta testing is open for public, Real Time Testing. then finally in software/apps go to production. 

In app purchase

 License-test users purchase your in-app products without any resulting charges to the user. Test purchases can be used in alpha/beta releases only.

To add Liecence user: Google play Console -> Settings -> Developer Account -> Account details  scroll down License Testing 

Tuesday, 2 September 2014

Android Login with Facebook 4

1) Create New Facebook App:
2) Add Facebook Id in AndoridManifest file:

   if facebook app id is 123456 then put it as below, change it as per your app id.

            android:value="123456" />

            android:exported="true" />

3)  Java Code (Get full code from here:

public class MyActivity extends AppCompatActivity  {

    CallbackManager callbackManager;
    Button btnLogin;

    protected void onCreate(Bundle savedInstanceState) {


    private void initUI() {
        callbackManager = CallbackManager.Factory.create();

                new FacebookCallback<LoginResult>() {
                    public void onSuccess(LoginResult loginResult) {
                        Log.d("Success", "Login");

                        if (loginResult.getAccessToken() != null) {
                            String strAccessToken = loginResult.getAccessToken().getToken();

                            Log.d("Token is", strAccessToken);


                    public void onCancel() {
                        showToast("Login Cancel");

                    public void onError(FacebookException exception) {

        btnLogin = (Button) findViewById(;
        btnLogin.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                LoginManager.getInstance().logInWithReadPermissions(MyActivity.this, Arrays.asList("public_profile", "user_friends"));

    public void getProfile(AccessToken accessToken) {

        GraphRequest request = GraphRequest.newMeRequest(
                new GraphRequest.GraphJSONObjectCallback() {
                    public void onCompleted(
                            JSONObject object,
                            GraphResponse response) {

                        //retrive email and name from here...
                        Log.d("JSON OBJECT OF PROFILE", object.toString());
                        Log.v("GraphResponse : ", response.toString());

        Bundle parameters = new Bundle();
        parameters.putString("fields", "id,name,email,gender, birthday");

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (callbackManager.onActivityResult(requestCode, resultCode, data)) {

4) You can use it in Fragment too.

    btnLogin.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                LoginManager.getInstance().logInWithReadPermissions(MyFragment.this, Arrays.asList("public_profile", "user_friends"));

Saturday, 3 November 2012

Android Custom Button Example

Android provides default UI Button for button view.But sometimes we need better UI for application and new colorful button rather than we need to create nice UI for button which looks awesome with application design.

 First you add button in your xml layout file.Then create xml in drawable folder for button background.

in xml drawable file add selector for button.

then add item tag for button state.which has different state like state_pressed,state_focused,state_enabled.

So here we used only state_pressed and check its true or false,then we add other property for both state

now  create two <item ></item> tag and put condition state_pressed or not.

After we can set corner radius for button and when we set radius its looks like rounded box.

Now we have <solid> tag for button inner you can set color for both state.

Using <padding> tab you can put inner spacing.and its considering space from corner of button,

And the last tag is <stroke> which is used for rounded colorful border.and you can set thickness of border using width and its have color also for colorful border.

Now just set your button background in xml layout flie.

So using below code you can create custom and if you want to set other color select your hex string and past in android:color in solid tag.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">

    <item android:state_pressed="true"><shape android:shape="rectangle">
            <corners android:radius="10dp" />

            <solid android:color="#0c76ab" />

            <padding android:bottom="10.0dip" android:left="10.0dip" android:right="10.0dip" android:top="10.0dip" />

            <stroke android:width="1.5dip" android:color="#222" />
    <item android:state_pressed="false"><shape android:shape="rectangle">
            <corners android:radius="10dp" />

            <solid android:color="#d9d9d9" />

            <padding android:bottom="10.0dip" android:left="10.0dip" android:right="10.0dip" android:top="10.0dip" />

            <stroke android:width="1.5dip" android:color="#222" />


Download Full Source Code

Saturday, 27 October 2012

Android View Pager With Remote Images

Android View Pager is Layout Manager you can change it Left and Right.And you can see more than one view using swapping.And its works like image galllery.

First insert ViewPager in your xml  layout file ::

        android:layout_margin="5dp" />

Now View Pager is working as a horizontal ScrollView.And View Pager have rows for each view.So create row for each view in layout,

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android=""
    android:padding="1dip" >

        android:contentDescription="desc" />

        android:visibility="gone" />


Now at Java Coding side create object of ViewPager and give References from XML file,And ViewPager set  Adapter for pager.

ViewPager pager = (ViewPager) findViewById(;
pager.setAdapter(new ImagePagerAdapter(imageUrls));

Now extends PagerAdapter Class For  View Pager's Adapter.Now we have override method which is inflate each row in pager and create view for Pager

        public Object instantiateItem(View view, int position) {

            final View imageLayout = inflater.inflate(
                    R.layout.item_pager_image, null);
            final ImageView imageView = (ImageView) imageLayout
            final ProgressBar spinner = (ProgressBar) imageLayout

instantiateItem Method is working as like as getView method in listView.

Now View Pager has PageChangeListener to listen page changing.You get current page using getCurrentPage from DetailOnPageChangeListener class.

pager.setOnPageChangeListener(new DetailOnPageChangeListener());

    public class DetailOnPageChangeListener extends
            ViewPager.SimpleOnPageChangeListener {

        private int currentPage;

        public void onPageSelected(int position) {

            currentPage = position;

        public int getCurrentPage() {
            return currentPage;


you get Current page using button click.So when you click on button get current page From Pager Listener. also and you can download below full source code:

Download Android View Pager

Thursday, 18 October 2012

Android Twitter Integration in Application

Android app have sharing feature like Facebook,Twitter and Email.So one of this is Twitter.

First open Twitter Developer Site .Then sign in Twitter and Right-Top side you can see your Twitter Name.Click and you get 3 options and click on My Applications.

Then Click on  Create a new Application.Then fill up form.

Don't forgot to add Callback URL in form otherwise its take it as Desktop Application and its can't work in mobile app.

After Successfully creating application you get Consumer key and Consumer secret.Copy it.

Now Click on Settings tab and Under Application Type change your Access Type to  "Read, Write and Access direct messages" and click on Button which name as Update this twitter application's settings.You get this message "Your application's settings have been successfully updated."
Now download below code and add your Consumer key and Consumer secret.Now you can Twitt from your application.

You  Can  Download Full Source Code From Here

Saturday, 29 September 2012

Android Multiple Select ListView

Android Multiple Choice ListView Using Custom Adapter.This listview you can use when you send sms to more than one friend or any notification to your friends.

So using Custom Adapeter we have to create row.xml layout which has checkbox.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""
    android:background="@android:color/white" >

        android:textStyle="bold" >

        android:focusableInTouchMode="false" >

 Now Using Adapter we can bind data to ListView.But we need to learn easy way to bind data with custom ListView and also hadle CheckBox Listener For Each Row.

So here i have RSS Feed to get data from web and then i add it in List<NameBean>.NameBean is bean class which contains value of Rss Feed Element and we have to maintain one boolean for checkbox state either checked or not.And generate Getters And Setters.

public class NameBean {

private String name;
private boolean selected;

public String getName() {
return name;

public void setName(String name) { = name;

public boolean isSelected() {
return selected;

public void setSelected(boolean selected) {
this.selected = selected;


Now when you get data through XML Parsing you have to create Object of NameBean and you can set data and add Object to List.

for (int temp = 0; temp < nList.getLength(); temp++) {

Node nNode = nList.item(temp);

                  if (nNode.getNodeType() == Node.ELEMENT_NODE) {

   Element eElement = (Element) nNode;

    NameBean objItem = new NameBean();

   objItem.setName(getTagValue("name", eElement));


Now list  is fill up with NameBean Objects.And you can retrive data in Adapter so when you set ListView you just retrieve data in getView(...) method of Adapter.

In getView(...) method put checkBox listener to listen checkbox is check or not, if its checked then set boolean true for that object of NameBean And if its not checked then setSelected false to Namebean object.

So when you start this example in listview and its get data from webservice and bind data to listview using NameAdapter Class.

import java.util.List;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

public class NamesAdapter extends ArrayAdapter<NameBean> {

private List<NameBean> list;
private LayoutInflater inflator;

public NamesAdapter(Activity context, List<NameBean> list) {
super(context, R.layout.row, list);
this.list = list;
inflator = context.getLayoutInflater();

public View getView(int position, View convertView, ViewGroup parent) {

ViewHolder holder = null;
if (convertView == null) {
convertView = inflator.inflate(R.layout.row, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(;
holder.chk = (CheckBox) convertView.findViewById(;
.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

public void onCheckedChanged(CompoundButton view,
boolean isChecked) {
int getPosition = (Integer) view.getTag();

convertView.setTag(, holder.title);
convertView.setTag(, holder.chk);
} else {
holder = (ViewHolder) convertView.getTag();


return convertView;

static class ViewHolder {
protected TextView title;
protected CheckBox chk;

When your listView is bind with data you can see checkbox in row with name and now you can get Selected name using NameBean Object and you can retrieve it from list.

                // Retrive Data from list Using for-each loop
                StringBuffer sb = new StringBuffer();
for (NameBean bean : items) {

if (bean.isSelected()) {

Now you get All Selected name from ListView.So its so easy to write Multiple Choice ListView in Android.

You Can Download Full Source Code

Wednesday, 26 September 2012

Android Populate Spinner From Sqlite Database

Android Spinner is DropDown Choice List in Android.You can pick up one item and make your choice from list.

When you get Data from database and display in Spinner, So first you have to create database to get data from database and save it in Dynamic Array.

So first Create that create database and add data in database.

package com.samir.spinner;

import java.util.HashSet;
import java.util.Set;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
private static final int DB_VERSION = 1;
private static final String DB_NAME = "mydb";
private static final String TABLE_NAME = "mytable";
private static final String _id = "_id";
private static final String name = "name";

public DatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);

public void onCreate(SQLiteDatabase db) {
String createTableQuery = "create table " + TABLE_NAME + "(" + _id+ "     INTEGER PRIMARY KEY," + name + " TEXT)";

public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)  

db.execSQL("drop table if exists " + TABLE_NAME);

public void insertData(String label) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(name, label);
db.insert(TABLE_NAME, null, values);

public Set<String> getAllData() {
Set<String> set = new HashSet<String>();
String selectQuery = "select * from " + TABLE_NAME;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
} while (cursor.moveToNext());
return set;

Now you can see Oncreate Method is Create Database and using query you can create database.Database have two column one in _id which is primary key and second is name which we  want to save in database.

Then Using  ContentValue you can insert Data in database see method insertData(String lable) in above class.

Now, To get All data from database you just fire query and its return Cursor.Then put data in dynamic array from cursor.See method  getAllData().

Here i used Set<String> as dynamic array Because Set doesnot allow duplicates.And Spinner only show unique name.

Once you get Set then you can easily convert it in List<String>.Then you can easily append data to spinner using ArrayAdapter.

       Set<String> set = db.getAllData();
       //Convert set into list
  List<String> list = new ArrayList<String>(set);
  //Sort Data Alphabetical order
  Collections.sort(list, new Comparator<String>() {
public int compare(String lhs, String rhs) {
return lhs.compareTo(rhs);
  adapter = new ArrayAdapter<String>(MainActivity.this,
android.R.layout.simple_spinner_item, list);

Now spinner have listener to listen selected item .

spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View v, int position,long id) {
     String name = parent.getItemAtPosition(position).toString();
showToast("You Selected Item :: " + name);
public void onNothingSelected(AdapterView<?> arg0) {

Download Full Source Code::

You Can Download Full Source Code

Android Testing App

Alpha Testing is conducted within organization and tested by developer/ team of developers/ testers. This testing is close for public.  ...