Tuesday, 1 November 2016

Thursday, 27 October 2016

Load PDF files



Using this code

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="#9EBA89" >

<ListView
 android:id="@+id/listView1"
 android:layout_width="match_parent"
 android:layout_height="wrap_content" >
</ListView>

</RelativeLayout>



MainActivity.java
package com.example.readpdfnames;

import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

File path;
ListView list;
static ArrayList<String> pdf_paths=new ArrayList<String>();
static ArrayList<String> pdf_names=new ArrayList<String>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

list=(ListView)findViewById(R.id.listView1);
pdf_paths.clear();
pdf_names.clear();

//Access External storage 
path = new File(Environment.getExternalStorageDirectory() + "");
searchFolderRecursive1(path);

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1pdf_names);
Log.e("aaaaaaaaaa"""+pdf_names);

list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
String path = pdf_paths.get(arg2);
File file = new File(path);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
});
}
private static void searchFolderRecursive1(File folder)
{
 if (folder != null)
 {
  if (folder.listFiles() != null)
  {
   for (File file : folder.listFiles())
   {
    if (file.isFile())
    {
     //.pdf files 
     if(file.getName().contains(".pdf"))
      {
       Log.e("ooooooooooooo""path__="+file.getName());
       file.getPath();
       pdf_names.add(file.getName());
       pdf_paths.add(file.getPath());
       Log.e("pdf_paths"""+pdf_names);
      }
     } 
     else 
     {
      searchFolderRecursive1(file);
     }
    }
   }
  }
 }
}


Php Projects Topics & Ideas

Get the widest variety of innovative php projects topics and ideas for php development with source codes at nevonprojects. Php is an open source and powerful language for web development. Php based projects are quite user friendly for development as well as database processing functions. We posses the greatest list of php projects for students, engineers and researchers. These php based systems are provided for php development learning and understanding through hands on project learning kit. We provide php projects with source code for php project learning & development.
Our php projects for hands on php learning and development practice. We also provide the largest list of php project ideas for your research. These ideas are actually php project topics that you may use for your own research. Also our projects contains contain php source codes to help you test and understand application workings. These php project topics help you learn about php development in no time. Get innovative php projects with source code and learning tutorials along with php development support. Keep visiting us here for more innovative php projects ideas and topics every week.

Android Project Ideas

Find latest android project topics for your final year engineering projects. These are innovative android app project ideas to be developed as final year projects by engineering students. Your search for latest project topics in android ends here. Nevonprojects provides a variety of android app project ideas to be developed as your final year project. These ideas have been researched and updated here every week for students to implement and use. Android platform has grown exponentially in terms of size and technology in the past years. Android is used for standalone as well as server based hybrid mobile phone system implementation. So here we provide a largest variety of android app development project ideas that can be implemented. These are innovative android based topics that can be implemented as full fledged innovative android applications and presented as final year engineering projects. Browse through our latest android app project ideas below:




For IT/Computers

Wednesday, 5 October 2016

Repeatedly Running Tast (TimerTask)

TimerTask task;

Timer timer;

        if (timer != null) {
            timer.cancel();
        }

        timer = new Timer();

        final Handler handler = new Handler();

        task = new TimerTask() {
            @Override
            public void run() {

                handler.post(new Runnable() {
                    @Override
                    public void run() {

                    // Do Thing you want to excute
                    }
                });
            }
        };

        timer.schedule( task, 0, 15000);



// Stop the Task

timer.cancel();

Make Call Directly

<Java Code>
Intent shortcutIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + Uri.encode(code)));                        startActivity(shortcutIntent);

<App Permission>

<uses-permission android:name="android.permission.CALL_PHONE" />

Check Internet Connectivity

<Java Method>

public static boolean isNetworkAvailable(Context context)
    {

        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();

    }


<App Permission>
<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />