Thursday, 21 January 2016

import android project from github into the android studio.

GitHub is open project directory for developers , so they can help each other or work on same project from anywhere in the world.But I think GitHub is the best tool for beginners to learn development as large no of projects available on the GitHub to access , commit (modify) and use as per license.

Today we are going to learn how to import android project from GitHub to android studio

System Requirement:

1. Git should be installed on your PC if not then download it from here and install on your pc.

   Note: After installing Git please add path "c:../program files/git/bin"( git.exe should be present this folder ) into system variables of your PC.

2. make sure that android studio-->settings-->Version Control-->git --> path to git executable pointing to the correct location where git is installed

Process to import from  GitHub :

step1:

1 . Open Android Studio .

2. Close the open project if any.

3. you  will see following window on screen.

4.Now click on VCS ( Check out version control)-->GitHub

5. Enter master password if you have GitHub account otherwise visit GitHub and sign up.

6. now new dialog box will appear copy and paste git Repository URL of project that you wish to import in android studio.

7. hit OK .

8. Give android studio some time complete its process because he is slower than you.

9. Congratulations  you did that Enjoy!!

Monday, 18 January 2016

Android : Listing all files stored in the Directory and its sub directories

          

 In this post we going to learn how to add files stored in the root directory and its sub directories to List .

Code:      

 

 Function call:

  List<File> files = getListFiles(new File("root directory"));

 Function:

 private List<File> getListFiles(File parentDir) { 

      ArrayList<File> inFiles = new ArrayList<File>(); 

      File[] files = parentDir.listFiles(); 

      for (File file : files) {  

      if (file.isDirectory()) { 

      inFiles.addAll(getListFiles(file)); 

      } else {  

      if(file.getName().endsWith(".csv")){

       inFiles.add(file); } }  

      }

  return inFiles;

  }