Thursday, August 15, 2013

Base Adapter With Json Data

Step1: You Just Follow Simple Step.

1.Create a new Activity in your Project. (MainActivity.java)


package com.valkesh.baseadapterdemo;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;
import android.widget.Toast;

import com.valkesh.adapter.FriendAdapter;
import com.valkesh.model.FriendDetailsListModel;
import com.valkesh.model.JSONParser;

public class MainActivity extends Activity {
private Context mContext;
private ListView FriendList;
private FriendAdapter friend_Adapter;
private String url = "";
private ArrayList<FriendDetailsListModel> mFriendsList = new ArrayList<FriendDetailsListModel>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FriendList = (ListView) findViewById(R.id.lv_friend_list);
url = "http://valkeshpatel.com/friend/f_id=1";
new ProgressTask().execute();
}

@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}

@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}

class ProgressTask extends AsyncTask<String, String, String> {
private ProgressDialog dialog;
private String response = null;

@Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new ProgressDialog(mContext);
dialog.setMessage("Loading Customer...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
dialog.show();
}

@Override
protected String doInBackground(String... params) {
JSONParser jParser = new JSONParser();
// get JSON data from URL
response = jParser.getResponseFromUrl(url);
return null;
}

@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
// if (dialog.isShowing()) {
dialog.dismiss();
// }

if (response.equalsIgnoreCase("") || response.trim().length() <= 0) {
Toast.makeText(mContext, "No data found", Toast.LENGTH_SHORT)
.show();
} else {
try {
Log.d("Drive_List_response", "" + response);
JSONArray objJsonArry = new JSONArray(response);
for (int i = 0; i < objJsonArry.length(); i++) {
JSONObject objJosn = objJsonArry.getJSONObject(i);
FriendDetailsListModel objModel = new FriendDetailsListModel();
objModel.setF_name(objJosn.getString("name"));
objModel.setDob(objJosn.getString("age"));
objModel.setGender(objJosn.getString("gender"));
mFriendsList.add(objModel);
}
} catch (JSONException e) {
e.printStackTrace();
Log.e("ERROR", e.toString());
}
Log.e("LISTSIZE", "" + mFriendsList.size());
friend_Adapter = new FriendAdapter(mContext, mFriendsList);
FriendList.setAdapter(friend_Adapter);
}
}
}
}


2.Create a new Activity XML File, Layout Folder In Project. (activity_main.xml).

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/common_bg"
    tools:context=".DisplayActivity" >

   <ListView
        android:id="@+id/lv_friend_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:cacheColorHint="#000000"
        android:divider="@null"
        android:dividerHeight="5dp" />

</RelativeLayout>

3.Create a new BaseAdapter File In Project. (FriendAdapter.java).

package com.valkesh.adapter;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.valkesh.baseadapterdemo.R;
import com.valkesh.model.FriendDetailsListModel;

public class FriendAdapter extends BaseAdapter implements
OnClickListener {


private Context mContext;
private ArrayList<FriendDetailsListModel> mFriendsListOriginal = new ArrayList<FriendDetailsListModel>();
private static LayoutInflater inflater = null;

public FriendAdapter(Context context,
ArrayList<FriendDetailsListModel> data) {
mContext = context;
mFriendsListOriginal = data;
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount() {
return mFriendsListOriginal.size();
}

@Override
public Object getItem(int position) {
return mFriendsListOriginal.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

static class ViewHolder {
TextView email_id, f_name, age, gender;
Button addHim;
}

public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;

LayoutInflater mInflater = (LayoutInflater) mContext
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.activity_display, null);
holder = new ViewHolder();
holder.f_name = (Button) convertView.findViewById(R.id.f_name);
holder.age = (Button) convertView.findViewById(R.id.age);
holder.gender = (Button) convertView.findViewById(R.id.gender);
holder.addHim = (Button) convertView.findViewById(R.id.trackhim);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
FriendDetailsListModel rowItem = (FriendDetailsListModel) getItem(position);

final String email_id_on = rowItem.getEmail_id();
final String name_on = rowItem.getEmail_id();

holder.f_name.setText(rowItem.getF_name());
holder.gender.setText(rowItem.getGender());
holder.age.setText(rowItem.getEmail_id());
holder.addHim.setOnClickListener(new  OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// Intent intent = new Intent(mContext, XYZ.class);
// mContext.startActivity(intent);
// ((Activity) mContext).finish();
}
});
return convertView;
}

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub

}

}
4.Create a new BaseAdapter File, Layout Folder In Project. (activity_display.xml).

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DisplayActivity" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="170dp"
        android:layout_alignParentLeft="true"
        android:background="@drawable/valkesh" />

    <Button
        android:id="@+id/f_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/imageView1"
        android:background="@drawable/bginterest"
        />

    <Button
        android:id="@+id/age"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/f_name"
        android:background="@drawable/bginterest"
        />

    <Button
        android:id="@+id/gender"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/age"
        android:background="@drawable/bginterest"
       />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/gender"
        android:layout_centerHorizontal="true" >

        <Button
            android:id="@+id/trackhim"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_weight="1"
            android:background="@drawable/button_bg"
            android:text="Like Me" />
    </LinearLayout>

</RelativeLayout>
5.Create a new Model Class (POGO) Project. (FriendDetailsListModel.java).

package com.valkesh.model;

public class FriendDetailsListModel {

private String friend_id;
private String email_id;
private String f_name;
private String dob;
private String gender;
/**
* @return the friend_id
*/
public String getFriend_id() {
return friend_id;
}
/**
* @param friend_id the friend_id to set
*/
public void setFriend_id(String friend_id) {
this.friend_id = friend_id;
}
/**
* @return the email_id
*/
public String getEmail_id() {
return email_id;
}
/**
* @param email_id the email_id to set
*/
public void setEmail_id(String email_id) {
this.email_id = email_id;
}
/**
* @return the f_name
*/
public String getF_name() {
return f_name;
}
/**
* @param f_name the f_name to set
*/
public void setF_name(String f_name) {
this.f_name = f_name;
}
/**
* @return the dob
*/
public String getDob() {
return dob;
}
/**
* @param dob the dob to set
*/
public void setDob(String dob) {
this.dob = dob;
}
/**
* @return the gender
*/
public String getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(String gender) {
this.gender = gender;
}
}


Monday, July 1, 2013

Upload Large Video File on server with CHUNK


Upload large Video File on Server

When we large or small file uploading on server then we have need to Convert into bytearray byte[] and My Researched base you can not convert file in to bytearray byte[] of over 10Mb easily.

In that Case you can easily get bytearray without any Memory error from this way 10 to 60 Mb file convert.



You can get byte[] data from file then follow this way:
First Way:

String filepath = "/mnt/sdcard/video.mp4";
String chaunksize = "100000";

byte[]  inputDatavideo = readbytedata(filepath, chaunksize );

public byte[] readbytedata(String SourceFileName, int CHUNK_SIZE)
            throws IOException {
        File willBeRead = new File(SourceFileName);
        int FILE_SIZE = (int) willBeRead.length();
        ArrayList<String> nameList = new ArrayList<String>();
        int NUMBER_OF_CHUNKS = 0;
        byte[] file_data = new byte[FILE_SIZE];
        try {
            InputStream inStream = null;
            int totalBytesRead = 0;

            try {
                inStream = new BufferedInputStream(new FileInputStream(
                        willBeRead));
                // int bytesRead = inStream.read(file_data, 0, FILE_SIZE);

                while (totalBytesRead < FILE_SIZE) {
                    String PART_NAME = "data" + NUMBER_OF_CHUNKS + ".bin";
                    int bytesRemaining = FILE_SIZE - totalBytesRead;
                    if (bytesRemaining < CHUNK_SIZE)
                    // Remaining Data Part is
                    // Smaller Than // CHUNK_SIZE // CHUNK_SIZE is assigned to
                    // remainvolume
                    {
                        CHUNK_SIZE = bytesRemaining;
                        System.out.println("CHUNK_SIZE: " + CHUNK_SIZE);
                    }
                    // Temporary Byte Array
                    int bytesRead = inStream.read(file_data, totalBytesRead,
                            CHUNK_SIZE);
                    if (bytesRead > 0) // If bytes read is not empty
                    {
                        totalBytesRead += bytesRead;
                        NUMBER_OF_CHUNKS++;
                    }
                }

            } finally {
                inStream.close();

            }
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return file_data;
    }

Second Way:

ArrayList<byte[]>  outputvideofile = bytearraydata.readbytedatass(filepath, chaunksize );


public ArrayList<byte[]> readbytedatass(String SourceFileName,
            int CHUNK_SIZE) throws IOException {
        // log.i("File Is Reading "+ SourceFileName );
        File willBeRead = new File(SourceFileName);
        int FILE_SIZE = (int) willBeRead.length();
        ArrayList<String> nameList = new ArrayList<String>();
        ArrayList<byte[]> byteList = new ArrayList<byte[]>();

        int NUMBER_OF_CHUNKS = 0;
        byte[] file_data = new byte[FILE_SIZE];
        try {
            InputStream inStream = null;
            int totalBytesRead = 0;

            try {
                inStream = new BufferedInputStream(new FileInputStream(
                        willBeRead));
                while (totalBytesRead < FILE_SIZE) {
                    String PART_NAME = "data" + NUMBER_OF_CHUNKS + ".bin";
                    int bytesRemaining = FILE_SIZE - totalBytesRead;
                    if (bytesRemaining < CHUNK_SIZE) // Remaining Data Part is
                                                        // Smaller Than
                                                        // CHUNK_SIZE
                    // CHUNK_SIZE is assigned to remain volume
                    {
                        CHUNK_SIZE = bytesRemaining;
                        System.out.println("CHUNK_SIZE: " + CHUNK_SIZE);
                    }
                    // temporary = new byte[CHUNK_SIZE]; // Temporary Byte Array
                    int bytesRead = inStream.read(file_data, totalBytesRead,
                            CHUNK_SIZE);
                    if (bytesRead > 0) // If bytes read is not empty
                    {
                        totalBytesRead += bytesRead;
                        NUMBER_OF_CHUNKS++;
                    }
                    nameList.add("/sdcard/" + PART_NAME);
                    byteList.add(file_data);
                }

            } finally {
                inStream.close();
            }
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return byteList;
    }

Tuesday, June 25, 2013

Update Non market android application

Step 1: Create a Class: UpdateapplicationV


import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
public class UpdateapplicationV extends AsyncTask<String,Void,Void>{
private Context context;
public void setContext(Context contextf){
    context = contextf;
}

@Override
protected Void doInBackground(String... arg0) {
      try {
            URL url = new URL(arg0[0]);
            HttpURLConnection c = (HttpURLConnection) url.openConnection();
            c.setRequestMethod("GET");
            c.setDoOutput(true);
            c.connect();

            String PATH = "/mnt/sdcard/Download/";
            File file = new File(PATH);
            file.mkdirs();
            File outputFile = new File(file, "update.apk");
            if(outputFile.exists()){
                outputFile.delete();
            }
            FileOutputStream fos = new FileOutputStream(outputFile);

            InputStream is = c.getInputStream();

            byte[] buffer = new byte[1024];
            int len1 = 0;
            while ((len1 = is.read(buffer)) != -1) {
                fos.write(buffer, 0, len1);
            }
            fos.close();
            is.close();

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.fromFile(new File("/mnt/sdcard/Download/update.apk")), "application/vnd.android.package-archive");
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
            context.startActivity(intent);


        } catch (Exception e) {
            Log.e("UpdateAPP", "Update error! " + e.getMessage());
        }
    return null;
}} 


Step 2: Add code in your main activity 

UpdateapplicationV atualizaApp = new UpdateapplicationV();
            atualizaApp.setContext(getApplicationContext());
            atualizaApp.execute("http://Your url/apkfile.apk");

Friday, June 21, 2013

Ref Link

R file does not generated:
 sudo apt-get install lib32z1

 sudo apt-get install lib32stdcc++6


Full stack chat xmpp Android Demo:
https://github.com/tech83/XMPP-Demo/tree/master/app/src/main/java/in/quantumtech/xmpp

Decompile APK file.
http://www.javadecompilers.com/apk


Bottom tabbar:
https://www.learn2crack.com/2017/06/android-using-bottomnavigationview.html



http://javapapers.com/web-service/java-web-service-using-eclipse/

http://javapapers.com/android/android-sqlite-database/

https://github.com/jgilfelt/android-sqlite-asset-helper

http://code.google.com/p/roottools/

http://code.google.com/p/android-roms/downloads/list/cyanogen_JFv1.51_CM3-ADP.zip

http://stackoverflow.com/questions/1101380/determine-if-running-on-a-rooted-device

chat application code:
https://github.com/Pirngruber/AndroidIM

https://code.google.com/p/simple-android-instant-messaging-application/



Android Billing Api

https://github.com/robotmedia/AndroidBillingLibrary

http://www.techotopia.com/index.php/Integrating_Google_Play_In-app_Billing_into_an_Android_Application_%E2%80%93_A_Tutorial


List View :
http://mrbool.com/how-to-use-json-to-parse-data-into-android-application/2894


http://www.androiddevelopersolution.com/2012/08/android-splash-screen-example.html
http://www.onlymobilepro.com/2013/01/16/android-beginner-creating-splash-screen/

 splash screen with background calling webservices.
http://www.androidhive.info/2013/07/how-to-implement-android-splash-screen-2/


cloud messages:
http://www.androiddevelopersolution.com/2012/12/android-goggle-cloud-messaging-gcm.html


Session Base Pref:
http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/

GCM
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/


Splace screen:
http://www.androidhive.info/2013/07/how-to-implement-android-splash-screen-2/

Bar-Chart
http://rakhi577.wordpress.com/category/comparision-chart/

webservices
http://www.themobilemontage.com/2012/11/29/successfully-integrating-web-services-into-your-android-apps/

android-page-curl
https://github.com/MysticTreeGames/android-page-curl


Ui Base framework:
http://spb.com/android-software/uibuilder/

android game
http://www.kilobolt.com/day-6-the-android-game-framework-part-ii.html


Android Timer Blog:
http://android-er.blogspot.in/2013/12/example-of-using-timer-and-timertask-on.html



creating_a_splash_screen
http://docs.xamarin.com/guides/android/user_interface/creating_a_splash_screen/


Paypal in android
http://www.androiddevelopersolution.com/2012/09/paypal-integration-in-android.html

 Learn Java Collection :
http://mrbool.com/overview-of-java-arraylist-hashtable-hashmap-hashetlinkedlist/30383

android Icon Size:
http://iconhandbook.co.uk/reference/chart/android/


In App billing in android:
http://blog.blundell-apps.com/simple-inapp-billing-payment/

Icon maker:
http://makeappicon.com/download/74510a609680493a8cdbf6dc76fb724f#

Sync Adapter
http://udinic.wordpress.com/2013/07/24/write-your-own-android-sync-adapter/

Video Camera:
http://stackoverflow.com/questions/1817742/how-can-i-capture-a-video-recording-on-android

Data Sync:
http://chariotsolutions.com/blog/post/android-data-sync/


http://www.programcreek.com/java-api-examples/index.php?api=org.apache.http.entity.mime.HttpMultipartMode


http://www.youtube.com/watch?v=ZScE1aXS1Rs
http://android-er.blogspot.in/2011/04/simple-exercise-of-video-capture-using.html


popup:
http://androidresearch.wordpress.com/2012/05/06/how-to-create-popups-in-android/


encode file
http://stackoverflow.com/questions/6448865/base64-encode-audio-file-and-send-as-a-string-then-decode-the-string

Android image maker system
https://www.fluidui.com/editor/live/

Android service Link:
http://mrbool.com/android-services-how-to-create-your-own-services-in-android/30607

Video Record

http://sandyandroidtutorials.blogspot.in/2013/05/android-video-capture-tutorial.html
http://android-er.blogspot.in/2011/10/simple-exercise-of-video-capture-using.html

MVC Pattern To Create Very Basic Shopping Cart

http://androidexample.com/MVC/index.php?view=article_discription&aid=116&aaid=138#at_pco=smlre-1.0&at_si=53a0b57cf5d1c09a&at_ab=per-2&at_pos=1&at_tot=4


Pull to refresh
http://www.tutecentral.com/android-pull-to-refresh/
https://github.com/erikwt/PullToRefresh-ListView
http://www.incredibleandros.com/swiperefershlayout-android-example/


Download apk from store:
http://apps.evozi.com/apk-downloader/?id=com.xlabz.FindNearMe2



Share on facebook:
http://stackoverflow.com/questions/20015410/customize-android-intent-action-send?lq=1
https://github.com/antonkrasov/AndroidSocialNetworks



Animation CODE:
https://github.com/daimajia/AndroidViewAnimations
https://github.com/sd6352051/NiftyDialogEffects
https://github.com/pedrovgs/DraggablePanel


Animation Button
https://github.com/dmytrodanylyk/circular-progress-button

https://github.com/ManuelPeinado/FadingActionBar


Date & time picker:
https://github.com/zenyagami/DateTimepicker


Demo Project Link:
https://github.com/vlado-github/CropManager


https://github.com/coolguy101/ExampleXMPP

screen size:
http://screensiz.es/phone


http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/

https://github.com/survivingwithandroid/Surviving-with-android

arc seekbar

http://rakeshandroid.blogspot.in/2013/03/circular-seek-bar-example.html

http://stackoverflow.com/questions/13678262/android-circular-seekbar

https://github.com/devadvance/circularseekbar


Background camera:
http://stackoverflow.com/questions/21752637/how-to-capture-an-image-in-background-without-using-the-camera-application

For English:
https://www.ego4u.com/en/cram-up/grammar/tenses

For ilets:
http://www.examenglish.com/


Best English learning site:
http://www.englishleap.com


For java-design-patterns
https://github.com/iluwatar/java-design-patterns


Java Webservices rest api
http://www.javatpoint.com/android-web-service


flash light
http://www.javacodegeeks.com/2014/02/android-torch-app-with-stroboscopic-light-tutorial.html


Create a Music Player on Android: Song Playback:

http://code.tutsplus.com/tutorials/create-a-music-player-on-android-song-playback--mobile-22778


Class a wallpaper:
http://www.wallpaperup.com/search/results/tattoo/11


Greate Site to Learn to java , c++, c

http://www.sanfoundry.com


Best in class solution:
http://blog.nkdroidsolutions.com/arraylist-in-sharedpreferences/


DynamicCardLayout:
https://github.com/dodola/DynamicCardLayout
https://github.com/wujingchao/MultiCardMenu
https://github.com/MartinRGB/GiftCard-Android
https://github.com/elcrion/demo.cardlistview

https://github.com/qianlvable/VectorCard
https://github.com/xmuSistone/android-image-slide-panel

https://github.com/wangwang4git/CardView-SwipeDelete
https://github.com/DakotaCKIM/Carduino

https://github.com/arturh85/SyncDroid-SD

https://github.com/backupbrain/android-ripple-wallet
https://github.com/mycelium-com/wallet
https://github.com/schildbach/bitcoin-wallet
https://github.com/greenaddress/GreenBits

https://github.com/Clans/FloatingActionButton
https://github.com/shaobin0604/Android-HomeKey-Locker

All things.
https://github.com/motianhuo/android-open-project


http://www.talkenglish.com/lessonindex.aspx

https://github.com/oscarjiv91/Android-Check-Internet-Connection


ebook for self help
https://www.goodreads.com/user/rate_books?reg_path=true#self-help



http://www.talkenglish.com/extralessons/speakingrules.aspx

Material-design
http://www.raywenderlich.com/103367/material-design
http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html

facebook login:
http://blog.nkdroidsolutions.com/android-facebook-login-example-v4/


Fragment
http://www.raywenderlich.com/117838/introduction-to-android-fragments-tutorial 

Best  Animation Sorce:
https://github.com/Tim9Liu9/TimLiu-Android?files=1 
https://github.com/w446108264/XhsWelcomeAnim 
https://github.com/chenupt/SpringIndicator 


Video file
https://www.udemy.com/become-an-android-developer-from-scratch/ 
https://www.udemy.com/learn-android-development-from-scratch/ 

https://www.udemy.com/android-material-design-zero-to-hero/ 


Lib32(When R file doe not generate in ubuntu):
http://stackoverflow.com/questions/2757107/developing-for-android-in-eclipse-r-java-not-regenerating  

Phrases

https://www.speaklanguages.com/english/phrases/general-conversation 
https://www.speaklanguages.com/english/vocab/ 


 Demo code:
https://github.com/theappguruz 

 Root your phone
https://www.youtube.com/watch?v=XHrENHpb9tI 

 Help for app intro
 https://github.com/deano2390/MaterialShowcaseView
https://github.com/PaoloRotolo/AppIntro 




https://github.com/ribot/android-guidelines/blob/master/project_and_code_guidelines.md 
 Google auth login
https://www.learn2crack.com/2014/01/android-google-oauth2.html 

MarshMallow permision

https://www.learn2crack.com/2015/10/android-marshmallow-permissions.html 
https://android-arsenal.com/demo 

https://github.com/nicolasjafelle/PagingListView/tree/master/PagingListViewProject/PagingListView/src/main


https://android-arsenal.com/details/1/2797


http://angrytools.com/android/pixelcalc/

 UI Test
http://developer.android.com/tools/debugging/debugging-ui.html

 Youyube player for android
https://github.com/turekon/YouTubePlayerAndroidApp
https://github.com/pedrovgs/DraggablePanel
https://github.com/TheFinestArtist/YouTubePlayerActivity
https://github.com/youtube/yt-android-player


https://github.com/kaltura/player-sdk-native-android
https://github.com/ybq/Android-SpinKit
https://github.com/Yalantis/Side-Menu.Android
https://github.com/amulyakhare/TextDrawable



http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/


 Best Code factory
 https://github.com/Pixplicity

Best inapp purchased:
https://github.com/anjlab/android-inapp-billing-v3

https://classroom.udacity.com/me 

 Learn java
http://stackoverflow.com/search?q=user:22656+[java] 

https://github.com/tcking/GiraffePlayer 

https://github.com/danylovolokh/VideoPlayerManager 

https://github.com/ashqal/MD360Player4Android 

https://github.com/googleads/google-media-framework-android 


https://github.com/lipangit/jiecaovideoplayer/blob/develop/README_CUSTOM_UI.md 

https://github.com/FunPanda08/VLCPlayer_Android/tree/master/src/org/videolan 
https://github.com/daedrag/citi-pocket 


https://github.com/wasabeef/awesome-android-ui 

Camera code: 
https://github.com/fabian7593/MagicalCamera
https://github.com/Skykai521/StickerCamera 


https://github.com/guojunyi/PullDownListView/blob/master/PullDownListView/src/com/pulldownlistview/MainActivity.java


https://www.numetriclabz.com/android-linkedin-integration-login-tutorial/ 

https://github.com/Yalantis/CameraModule 
https://github.com/Yalantis/uCrop 

Getting contact from gmail
https://www.design19.org/blog/import-google-contacts-with-php-or-javascript-using-google-contacts-api-and-oauth-2-0/ 



***********************************************************
http://www.perfect-english-grammar.com/english-language-pdf.html
https://www.uop.edu.jo/download/research/members/Oxford_Guide_to_English_Grammar.pdf
----------------------------------------------------------------------------------------------------------------------
http://www.englishgrammar.org/common-idioms-english/
----------------------------------------------------------------------------------------------------------------------
http://www.grammar-teacher.com/englishgrammarsecrets.pdf
----------------------------------------------------------------------------------------------------------------------
https://www.easypacelearning.com/english-books/english-books-for-download-pdf/category/6-english-grammar-pdf-and-word-doc

***********************************************************
https://github.com/afollestad/easy-video-player

https://github.com/fbsamples/360-video-player-for-android

https://github.com/googlesamples/android-UniversalMusicPlayer 

************************************************************
Camera Class:Capture image and record video.
https://github.com/afollestad/material-camera


***********************************************************
Document Scanner with opencv.
https://github.com/ctodobom/OpenNoteScanner

***********************************************************
Epub reader
https://github.com/FolioReader/FolioReader-Android 



***********************************************************
Video Chat Code Sample:
https://github.com/xaccc/Communicator-for-Android
*********************************************************** 


 Arc View:
*********************************************************** 
https://android-arsenal.com/details/1/4694
*********************************************************** 

 

android-vertical-slide-view

*********************************************** 

https://android-arsenal.com/details/3/4653 

***********************************************************


https://android-arsenal.com/details/1/4530

***********************************************************
List Video play

https://android-arsenal.com/details/1/4548
***********************************************************
https://github.com/brucetoo/VideoControllerView
***********************************************************

***********************************************************
Background uploading Image or video with multi-part.

https://github.com/gotev/android-upload-service
***********************************************************

Ilets:
http://www.qposter.com/2015/05/Download-Cambridge-Practice-Tests-For-IELTS-1-10-With-PDF-File-Audio-CD-And-Answers.html



 
Android:  Boom Menu
https://android-arsenal.com/details/1/4912\




////////////////////////////////////////////////////////////////////////
http://therecipies.blogspot.in/2013/05/recipe-of-aloo-tikki.html 

 Get Distance From two location.

http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false 


https://github.com/nex3z/FlowLayout


 

Thursday, June 20, 2013

ScrollView set gravity on top , bottom in Android



public void onClick(View v) {
                    final Handler handler = new Handler();
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {
                            }
                            handler.post(new Runnable() {
                                @Override
                                public void run() {
                                    scrollView_On_Top.fullScroll(View.FOCUS_UP);
                                  //scrollView_On_Top.fullScroll(View.FOCUS_DOWN);
                                }
                            });
                        }
                    }).start();
                                  }

Sunday, June 2, 2013

Turn Wifi On/Off using WifiManager.setWifiEnabled() or WifiManager.setWifiDisabled()

Turn Wifi On/Off using WifiManager.setWifiEnabled() or WifiManager.setWifiDisabled()

Step 1:  ADD Or modify main.xml to add to button. in Layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="@string/hello"
   />
<TextView 
   android:id="@+id/wifistate"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   />
<Button
   android:id="@+id/onwifi"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="Turn Wifi On"
   />
<Button
   android:id="@+id/offwifi"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="Turn Wifi Off"
   />
</LinearLayout> 

Step 2: Add Or change code in your MainActivity Class.

package com.exercise.WifiStateChangedValkesh; 
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class WifiStateChangedValkesh extends Activity {
 
 TextView WifiState;
 
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       WifiState = (TextView)findViewById(R.id.wifistate);
       Button OnWifi = (Button)findViewById(R.id.onwifi);
       Button OffWifi = (Button)findViewById(R.id.offwifi);
      
       this.registerReceiver(this.WifiStateChangedReceiver,
               new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
      
       OnWifi.setOnClickListener(new Button.OnClickListener(){

   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    WifiManager wifiManager = (WifiManager)getBaseContext().getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(true);
   }});
      
       OffWifi.setOnClickListener(new Button.OnClickListener(){

   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    WifiManager wifiManager = (WifiManager)getBaseContext().getSystemService(Context.WIFI_SERVICE);
    wifiManager.setWifiEnabled(false);
   }});
   }
  
   private BroadcastReceiver WifiStateChangedReceiver
   = new BroadcastReceiver(){

  @Override
  public void onReceive(Context context, Intent intent) {
   // TODO Auto-generated method stub
   
   int extraWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE ,
     WifiManager.WIFI_STATE_UNKNOWN);
   
   switch(extraWifiState){
   case WifiManager.WIFI_STATE_DISABLED:
    WifiState.setText("WIFI STATE DISABLED");
    break;
   case WifiManager.WIFI_STATE_DISABLING:
    WifiState.setText("WIFI STATE DISABLING");
    break;
   case WifiManager.WIFI_STATE_ENABLED:
    WifiState.setText("WIFI STATE ENABLED");
    break;
   case WifiManager.WIFI_STATE_ENABLING:
    WifiState.setText("WIFI STATE ENABLING");
    break;
   case WifiManager.WIFI_STATE_UNKNOWN:
    WifiState.setText("WIFI STATE UNKNOWN");
    break;
   }
   
  }};
}
 

Step 3: Add permission "android.permission.CHANGE_WIFI_STATE" AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.exercise.WifiStateChangedValkesh"
     android:versionCode="1"
     android:versionName="1.0">
   <application android:icon="@drawable/icon" android:label="@string/app_name">
       <activity android:name=".WifiStateChangedValkesh"
                 android:label="@string/app_name">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>

   </application>
   <uses-sdk android:minSdkVersion="4" />
   <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
</manifest>

Install Oracle Java 7 (JDK & JRE) in Ubuntu 13.04 , 12,10 and LinuxMin.

 Install Oracle Java 7 (JDK & JRE) in Ubuntu 13.04 , 12,10 and LinuxMin.
Step 1: Open  Terminal.

Step2:  Copy this command on terminal.

         sudo add-apt-repository ppa:webupd8team/java

Step3:  Copy this command on terminal.
        
          sudo apt-get update

Step4:  And Last, Copy this command on terminal.
        
          sudo apt-get install oracle-java7-installer
  

Saturday, June 1, 2013

How to enable fast scrolling in Android

Fast Scrolling in Android happens when you have a lot of items in your screen and you need to scroll fast. When it is activated you well see an small box coming from the right of the screen and when you drag it up or down it goes really fast. You can see this in your contact list, email or any application that has a lot of data and is sorted alphabetically.

There are 2 ways to enable this functionality in your application:
By adding the property in your XML layout file:



    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fastScrollEnabled="true" />

or by adding it in your java code:

      getListView().setFastScrollEnabled(true);

Monday, May 20, 2013

Camera Video Capture And Save On SDCard - Android Example


XML FILE : AndroidManifest.xml

 



<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.androidexample.camera"
      android:versionCode="1"
      android:versionName="1.0">
     
    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="17" />
    <application android:icon="@drawable/icon"
        android:label="@string/app_name">
        <activity android:name="com.androidexample.camera.VideocameraActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
     
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- For android.media.audiofx.Visualizer -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
        <!-- We will request access to the camera, saying we require a camera
         of some sort but not one with autofocus capability. -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
     
</manifest>


JAVA FILE : VideocameraActivity.php

 

 1.  Opening android phone inbuild camera by camera intent.
  2.  Capture photo and again return on VideocameraActivity.java onActivityResult method.
  3.  Inside onActivityResult method getting captured video saved path and showing path on activity.

package com.valkeshexample.camera;
import java.io.File;
import java.text.SimpleDateFormat;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class VideocameraActivity extends Activity {
     
    private Uri fileUri;
    public static final int MEDIA_TYPE_VIDEO = 2;
    private static final int CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE = 200;
    public static VideocameraActivity ActivityContext =null;
    public static TextView val_output;
     
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ActivityContext = this;
         
        Button buttonRecording = (Button)findViewById(R.id.recording);
        val_output = (TextView)findViewById(R.id.val_output);
         
        buttonRecording.setOnClickListener(new Button.OnClickListener(){
            @Override
            public void onClick(View arg0) {
                 
                // create new Intentwith with Standard Intent action that can be
                // sent to have the camera application capture an video and return it.
                Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
                // create a file to save the video
                fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
                 
                // set the image file name 
                intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); 
                 
                // set the video image quality to high
                intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
                // start the Video Capture Intent
                startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
                 
            }});
         
         
    }
     
    /** Create a file Uri for saving an image or video */
    private static Uri getOutputMediaFileUri(int type){
         
          return Uri.fromFile(getOutputMediaFile(type));
    }
    /** Create a File for saving an image or video */
    private static File getOutputMediaFile(int type){
         
        // Check that the SDCard is mounted
        File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
                  Environment.DIRECTORY_PICTURES), "MyCameraVideo");
         
         
        // Create the storage directory(MyCameraVideo) if it does not exist
        if (! mediaStorageDir.exists()){
             
            if (! mediaStorageDir.mkdirs()){
                 
                val_output.setText("Failed to create directory MyCameraVideo.");
                 
                Toast.makeText(ActivityContext, "Failed to create directory MyCameraVideo.",
                        Toast.LENGTH_LONG).show();
                 
                Log.d("MyCameraVideo", "Failed to create directory MyCameraVideo.");
                return null;
            }
        }
         
        // Create a media file name
         
        // For unique file name appending current timeStamp with file name
        java.util.Date date= new java.util.Date();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
                             .format(date.getTime());
         
        File mediaFile;
         
        if(type == MEDIA_TYPE_VIDEO) {
             
            // For unique video file name appending current timeStamp with file name
            mediaFile = new File(mediaStorageDir.getPath() + File.separator +
            "VID_"+ timeStamp + ".mp4");
             
        } else {
            return null;
        }
        return mediaFile;
    }
     
     
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         
        // After camera screen this code will excuted
         
        if (requestCode == CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) {
             
            if (resultCode == RESULT_OK) {
                 
                val_output.setText("Video File : " +data.getData());
                 
                // Video captured and saved to fileUri specified in the Intent
                Toast.makeText(this, "Video saved to:
" +
                         data.getData(), Toast.LENGTH_LONG).show();
                 
            } else if (resultCode == RESULT_CANCELED) {
                 
                val_output.setText("User cancelled the video capture.");
                 
                // User cancelled the video capture
                Toast.makeText(this, "User cancelled the video capture.",
                        Toast.LENGTH_LONG).show();
                 
            } else {
                 
                val_output.setText("Video capture failed.");
                 
                // Video capture failed, advise user
                Toast.makeText(this, "Video capture failed.",
                        Toast.LENGTH_LONG).show();
            }
        }
    }
     
}

XML FILE : main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
      <Button
            android:id="@+id/recording"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Capture Video"
            />
   <TextView 
    android:id="@+id/val_output"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello"
     
    />
</LinearLayout>