Monday, September 30, 2013

The Specification & Design of Samsung Galaxy S5

I get mail from her official of the Samsung Galaxy S5 who are Mockup . I realized that this design could be the next Galaxy S-5's design Samsung .Maka up with some of the speaks found .

 It is may be  Upcoming Samsung Galaxy S5's design . 









Specification
*5.3-inch OLED YOUM display
* 3Gb Ram
*2 GHz Exynos 5 Octa-Core processor
*Android 4.4 Kitkat OS onboa rd
*16 MP Carl Zeiss lens a la Xperia Z1 for the back facing camera and a 3.2 MP front-facing camera
*3464/22.8 GB storage options
* 3,200 mAh Li-ion battery

Current Caller location & ID Review & Download best apps for android

The many reason we need to know is that the caller was from phone . we need to do unknown call & message . For this reason we are use many apps . This apps name is Current Caller location & ID this is the best apps for android . Current Caller location & ID apps i have best apps for android . The apps often many facility Call blocking, call managing, including the caller's Place is much more . How many calls or sent text in the graph is the easily . 


How to install :

1. 1st open this apps . 
2. click install .
3. SD card than ok button . 


 4. Done 

How to use it :

 6. open this .


7. Next Tip 


8.  Next Tip


9. Get Started click 


10. Last 3month calls& text graph 

11. Setting option here . 

12 . blocking option here .

Features :

1. All calls and text all of the information required for this app

2.  All contact with the app, the message to manage .

3. Option to block incoming calls and messages

4. We will have information about the caller. For example, where the 
 caller can know right now I have to call or text

5. can be In addition to the location of the caller to notify the local weather 

6. Caller Facebook, Twitter, Linked-In ID can be linked.

7. Call friends and I can take it one of the graphs and text easily .

8. What is the day when the phone or by text that can be seen in the form of charts 


  
   

Your Magnifying Glass


Magnifies text or anything else, with a large clear view (the quality and the zoom level of the image depends on your phone's camera). You can choose the zoom level with a slider or using your phone's volume up and down buttons, invert the image (helps nearly blind people to see text better), freeze the image, or even turn on the light (on phone's with a flash for their camera) to make it brighter.


Keywords : Magnifying glass, magnify

Saturday, September 28, 2013

Send Email

In this post, you learn to create an e-mail sender app to send e-mail message and attached file from your Android smart phone to an e-mail address. Now open your Eclipse and create a new project call emailsender. For this app, we have the simple interface as shown in the screen shot below.

e-mail sender main interface


Views or components for this user interface are three EditText. One EditText allows the user to input the recipient e-mail address; One is to input the subject and another one is for inputting the message. The content of the main_layout.xml that is the resource of the user interface is shown below:

main_layout.xml file

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 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:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/mail_address"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/mail_address" />  

    <EditText
        android:id="@+id/mail_subject"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="@string/mail_subject" />
 

    <EditText
        android:id="@+id/mail_text"
        android:layout_width="fill_parent"
        android:layout_height="200sp"
        android:hint="@string/mail_text"
        android:gravity="top"
        />

</LinearLayout>


The send and attach icons are placed on the action bar (see the picture above). By clicking the send icon on the action bar, a list of mail clients installed on your system is displayed to receive your message to send it to the recipient. The attach icon allows the user to attach a file to be sent along the e-mail message.
To setup action bar for the e-mail sender app, the SherlockActionBar library is used. If you don't know how to add this project library to your project, please read this TextViewer post.
When the user selects the attach icon from the action bar, a file chooser dialog shows up so that the user can choose any file that he/she wants to attach to the e-mail message. The FileChooser class that created in the previous post (FileChooser) is integrated with the e-mail sender app to show the file chooser dialog. The steps below tell you how to integrate the FileChooser with this app.

1. Copy the selection_style.xml, fileicon.png, and diricon.png files to the res/drawable directory
2. Copy the listlayout.xml file to the res/layout directory
3. Copy the AndFileChooser.java and ListAdapterModel.java files to the src directory and rename the package to match the package name of the e-mail sender app.
4. In the res/menu directory, replace the auto-generated main.xml file with the main.xml file from the FileChooser app.

e-mail sender showing file chooser


The AndroidManifest.xml file is modified to apply icon (mmail) and use the Shecklock sheme in the e-mail sender app. The content of this file is written as shown below.

AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.emailsender"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/mmail"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock.Light.DarkActionBar">
        <activity android:configChanges="orientation"
            android:name="com.example.emailsender.MainActivity"
            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>

</manifest>


Now, we take a look at the MainActivity.java file. In this file, code are written to display file chooser dialog and receive the selected file path, and to send the e-mail message.

MainActivity.java file

package com.example.emailsender;

import java.util.List;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;
import android.net.Uri;
import android.os.Bundle;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.widget.EditText;

public class MainActivity extends SherlockActivity {

AndFileChooser filechooser;
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);
       
    }

@Override
    public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
        getSupportMenuInflater().inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }

   
    protected void onStart(){
    super.onStart();
    filechooser=new AndFileChooser("/",this); //create file chooser dialog
    }
   
    public void sendmail(){
    //get the selected file path
    String att_path=filechooser.getFilePath();
    //get address, subject, and message input by the user
    EditText txto=(EditText) findViewById(R.id.mail_address);
    EditText txtsubject=(EditText) findViewById(R.id.mail_subject);
    EditText txtmessage=(EditText) findViewById(R.id.mail_text);
    //create a Uri object to for the selected file path
    Uri urlpath=Uri.parse("file://"+att_path);
    //create an intent object for sending action
    Intent intent=new Intent(Intent.ACTION_SEND);
    //specify the minetype of the e-mail message
    intent.setType("*/*");    
    //put the recipient e-mail address in the intent object
    intent.putExtra(Intent.EXTRA_EMAIL,txto.getText().toString());
    //put the subject in the intent object
    intent.putExtra(Intent.EXTRA_SUBJECT,txtsubject.getText().toString());
    //put the message in the intent object
    intent.putExtra(Intent.EXTRA_TEXT,txtmessage.getText().toString());
    //put attached file in the intent object
    intent.putExtra(Intent.EXTRA_STREAM,urlpath);
    //Find available apps to receive the intent and start the intent if find one
    PackageManager pm=getPackageManager();
    List<ResolveInfo> vapps=pm.queryIntentActivities(intent, 0);
    if(vapps.size()>0){
    startActivity(Intent.createChooser(intent,"Send mail"));
    }
       
    }
   
    public void browse(){
   
    filechooser.show(); //show the file chooser dialog
   
   
    }
 
    public boolean onOptionsItemSelected(MenuItem item) {
        super.onOptionsItemSelected(item);
        switch(item.getItemId()){
       
            case R.id.send: //send item is selected
            sendmail();
                break;

            case R.id.attach: //attach item is selected
            browse();
                break;

        }
       return true;
    }

   
   
}



In the onStart method, a AndFileChooser object is created by the following line of code.

filechooser=new AndFileChooser("/",this); //create file chooser dialog

To handle which item of the action bar is selected, you need to override the onOptionsItemSelected method. The switch... case statement is used to determine the selected item. The browse method is called to show the file chooser dialog when the selected item is the attach item. Otherwise, the sendmail method is called to send the e-mail message to the e-mail client.
In th sendmail method, the getPath method of the AndFileChooser object is used to get the path of the selected file. The e-mail data such as recipient e-mail address, subject, message, and attached file are collected and placed in the intent object to be sent to the mail client. You need to specify ACTION_SEND to the intent for e-mail sending. The PackageManager class to read the mail clients installed on the system and show a list of the available mail client apps. The startActivity method is called to start sending the e-mail message.
Now you are ready to run the e-mail sender app on your emulator. The apk file of this app is also provided through the link below so you can download and install it on your real device.

Download the apk file of the e-mail sender app

WiFi File Transfer


WiFi File Transfer lets you upload and download files to/from your phone or tablet over a wireless connection. Easy-to-use web interface, no USB cable needed.

FEATURES
• Upload or download multiple files at once
• Upload entire folder structures (Google Chrome only)
• Delete, rename, copy, zip or unzip files using the built-in file manager interface
• Password authentication (optional)
• Shortcuts to photo, video and music directories
• Runs as a background service
• View photos directly in your web browser (integrated thumbnail gallery)
• Autostart service when connected to home network (optional)
• Provides access to external SD cards and USB storage devices

How to Apply for Online Banking in SBI

The Option of Online Banking is Implemented in various Banks like SBI and still more and more are Implementing this Service. It is Not that Difficult to Apply for Online Banking in SBI, you just need to have Some patience for this and Basic Computer Skills to Operate your account via Online



SBI Internet Banking

How to Apply for Online Banking in SBI

1) The Basic Requirement is your Bank account, you must be an SBI Bank Customer to Avail this Service

2) Download the Online SBI Form and Fill the Details as per your bank account and Submit to your Bank

3) Then they will give an Username and Password to you, after the First Login you should need to change your username and Password

4) After Login to the SBI you can Biew your Transactions, and other Details, just you need an PC and Internet Connection

5) You need to put Different Passwords for your profile and your account

6) You have Limited access only even you got internet banking, sometimes you cannot get Full Transaction rights , if this is your case contact your nearest SBI branch

7) They have an Online Virtual Keyboard which Protects your data from Phishing


Do's In Internet Banking

1) Whenever you are Leaving your Session, Please Logout manually, In default SBI will not allow you to remain idle for more than some time, but in safer you can do this

2) Never Reveal your Password to anyone, it results in Complicated problems when they started to misuse your account

3) Always use Virtual keyboard when typing Usernames and Passwords, Never use Normal Keystrokes

Dont's in Internet Banking

1) Never use your Internet Banking in Cyber Cafe, even if it is try to avoid Direct keystrokes

2) Never Respond to the Scam emails sent to you by Scammers to Steal your Data, if you have any Problem it is better to Directly Contact with them


So Why late, Have an Safe and Good Internet Banking in SBI

Friday, September 27, 2013

SMS/MMS & CallLog backup in gmail account for andriod mobile

Day by Day android phone making easy life everyday . SMS/MMS &  Call Log  backup is the free android market apps . Your phone is lost or damaged, you can restore it at any time, from a previous backup
SMS/MMS &  Call Log you can easily . Your SMS/MMS &  Call Log  backup  From gmail  via computer can see easily . SMS/MMS &  Call Log  backup this apps can sms/mms& call log backup in gmail account . 

How to use it :  

First install this apps and connect your gmail account . please see this picture . 


when connect your gmail then click backup button then started backpacking .Advanced settings allow you to take advantage of backup .
Click the Auto Backup Auto backup will be stored on your Gmail . 



The two labels in your Gmail will be created as shown below . Here you can see the detailed call logs SMS backup . 


  Features :

1. This apps is very importent .

2. Do not lose SMS / MMS , call log .

3. Easily use it .

4. safety our personal sms/mms .

Download :  SMS/ MMS Backup
 

How to Track DTDC DFL Fedex Bluedart Courier Status online

The Easy step in Courier Services Like DTDC, DFL, Fedex, Bluedart is the option of Track their Status online for getting the Present Status of your Parcel  When it is not Reached yet. I am Listing the Steps for Tracking the Top Courier Services Online here

DTDC DFL Track


1) How to Track DTDC Courier Status online 
  •  DTDC was India's Biggest Courier Service Provider and it has Good Network Global wide too
  • It is Securable and Trusted Brand for more Customers upto date
  • It serves more than 250 Destinations and handling more than 15,000 Consignments every month
There are two ways to track your DTDC Courier Status online 
  •  By Online - First go to their Tracking Page
  • Enter your Consignment Number in the Box 
  • Now Click on ''Go'', your Status is Displayed
The Second way is to Track your Status by SMS
  • Just Send Sms as " DTDC Consignment No " to the Number 9845324040
  • The Space must be given between the DTDC and Consignment Number
2) How to Track DFL Courier Online
  • The Best way to Track DFL Courier Service was by Online
  • Go to their Tracking page and fill the Shipment Number
  • Click on "Track" now
  • Your Status is Now displayed 
  • You can also take their Help by calling their Toll free number 1800 111 345
3) How to Track Fedex Courier Online
  • Fedex is an Best Courier Service so far in india
  • To track their Parcels, go to their Tracking page
  • There are three options given by them one is Tracking Number, second is Track by Reference, third is Obtain Proof of Delivery
  • The First and second will give your Status of Fedex courier and third will give the proof of Delivery
4) How to Track Bluedart Courier Online
  • The Best Courier Service provider in South Asia is Bluedart, Even the Adsense Cheques also came through Bluedart only
  • Go their Official Website and Click on "Track your Shipment" link
  • Now your Status of Bluedart was displayed




Thursday, September 26, 2013

FakkuDroid v2.6.1 - 2.7.0

FakkuDroid v2.6.1

Well, I have been very busy, sorry for the delay.

This version only fix a problem with the downloads, if you have problems to read or download an manga, please test it and write me in the comments if it works, now :D.

PD.- Improve performance in downloads, too.

-----------------------------------------------------------------------------------

FakkuDroid v2.7.0

Features:
- Improve the lists of mangas and favorites (now, the app downloads the images concurrently).

"I still have problem with downloading..." ~Anonymous
I made some changes to the code, please test it and write me if it is working now.

PD.- If I wrote wrong, please correct me in the comments.

Using the Hardware Scaler for Performance and Efficiency

Posted by Hak Matsuda and Dirk Dougherty, Android Developer Relations team



If you develop a performance-intensive 3D game, you’re always looking for ways to give users richer graphics, higher frame rates, and better responsiveness. You also want to conserve the user’s battery and keep the device from getting too warm during play. To help you optimize in all of these areas, consider taking advantage of the hardware scaler that’s available on almost all Android devices in the market today.



How it works and why you should use it



Virtually all modern Android devices use a CPU/GPU chipset that includes a hardware video scaler. Android provides the higher-level integration and makes the scaler available to apps through standard Android APIs, from Java or native (C++) code. To take advantage of the hardware scaler, all you have to do is render to a fixed-size graphics buffer, rather than using the system-provided default buffers, which are sized to the device's full screen resolution.



When you render to a fixed-size buffer, the device hardware does the work of scaling your scene up (or down) to match the device's screen resolution, including making any adjustments to aspect ratio. Typically, you would create a fixed-size buffer that's smaller than the device's full screen resolution, which lets you render more efficiently — especially on today's high-resolution screens.



Using the hardware scaler is more efficient for several reasons. First, hardware scalers are extremely fast and can produce great visual results through multi-tap and other algorithms that reduce artifacts. Second, because your app is rendering to a smaller buffer, the computation load on the GPU is reduced and performance improves. Third, with less computation work to do, the GPU runs cooler and uses less battery. And finally, you can choose what size rendering buffer you want to use, and that buffer can be the same on all devices, regardless of the actual screen resolution.



Optimizing the fill rate



In a mobile GPU, the pixel fill rate is one of the major sources of performance bottlenecks for performance game applications. With newer phones and tablets offering higher and higher screen resolutions, rendering your 2D or 3D graphics on those those devices can significantly reduce your frame rate. The GPU hits its maximum fill rate, and with so many pixels to fill, your frame rate drops.





style="border-radius: 6px;padding:0;margin:0;" />

Power consumed in the GPU at different rendering resolutions, across several popular chipsets in use on Android devices. (Data provided by Qualcomm).



To avoid these bottlenecks, you need to reduce the number of pixels that your game is drawing in each frame. There are several techniques for achieving that, such as using depth-prepass optimizations and others, but a really simple and effective way is making use of the hardware scaler.



Instead of rendering to a full-size buffer that could be as large as 2560x1600, your game can instead render to a smaller buffer — for example 1280x720 or 1920x1080 — and let the hardware scaler expand your scene without any additional cost and minimal loss in visual quality.



Reducing power consumption and thermal effects



A performance-intensive game can tend to consume too much battery and generate too much heat. The game’s power consumption and thermal conditions are important to users, and they are important considerations to developers as well.



As shown in the diagram, the power consumed in the device GPU increases significantly as rendering resolution rises. In most cases, any heavy use of power in GPU will end up reducing battery life in the device.



In addition, as CPU/GPU rendering load increases, heat is generated that can make the device uncomfortable to hold. The heat can even trigger CPU/GPU speed adjustments designed to cool the CPU/GPU, and these in turn can throttle the processing power that’s available to your game.



For both minimizing power consumption and thermal effects, using the hardware scaler can be very useful. Because you are rendering to a smaller buffer, the GPU spends less energy rendering and generates less heat.



Accessing the hardware scaler from Android APIs



Android gives you easy access to the hardware scaler through standard APIs, available from your Java code or from your native (C++) code through the Android NDK.



All you need to do is use the APIs to create a fixed-size buffer and render into it. You don’t need to consider the actual size of the device screen, however in cases where you want to preserve the original aspect ratio, you can either match the aspect ratio of the buffer to that of the screen, or you can adjust your rendering into the buffer.



From your Java code, you access the scaler through SurfaceView, introduced in API level 1. Here’s how you would create a fixed-size buffer at 1280x720 resolution:




surfaceView = new GLSurfaceView(this);
surfaceView.getHolder().setFixedSize(1280, 720);


If you want to use the scaler from native code, you can do so through the NativeActivity class, introduced in Android 2.3 (API level 9). Here’s how you would create a fixed-size buffer at 1280x720 resolution using NativeActivity:




int32_t ret = ANativeWindow_setBuffersGeometry(window, 1280, 720, 0);


By specifying a size for the buffer, the hardware scaler is enabled and you benefit in your rendering to the specified window.



Choosing a size for your graphics buffer



If you will use a fixed-size graphics buffer, it's important to choose a size that balances visual quality across targeted devices with performance and efficiency gains.



For most performance 3D games that use the hardware scaler, the recommended size for rendering is 1080p. As illustrated in the diagram, 1080p is a sweet spot that balances a visual quality, frame rate, and power consumption. If you are satisfied with 720p, of course you can use that size for even more efficient operations.



More information



If you’d like to take advantage of the hardware scaler in your app, take a look at the class documentation for SurfaceView or NativeActivity, depending on whether you are rendering through the Android framework or native APIs.

Watch for sample code on using the hardware scaler coming soon!



Wednesday, September 25, 2013

The New Nexus 7 Different Old Nexus 7

Recently Google has released the Android 4.3 operating system jelibin. The 4.3 jelibin the Google Nexus family is completely new Nexus 7 . Much of this information is new Nexus device. Google Nexus 7 through 2012 who maintained that to achieve success in whatever you decided to bring this new Nexus device on the market . Today we are discuss different   New Nexus 7   Old Nexus 7 . 


Design : 





The design of the new Nexus 7 did not change much . It's like the Nexus 7 2012 , Nexus 2013 7's back was smooth rubber coatings, which is why the device does not slip from your hands . 2013 Nexus 7, but the changes that I like to read the position of the rear camera. The new Nexus 7 rear camera on the device at the back of the upper left corner .  With the dual stereo speakers.
This new device is compared with the previous Nexus 7 2mm thin, weighing less than 50 grams and less than that of the screen border.

Display : 

 No changes were the new Nexus 7's screen sizes. However, the resolution is changed.  The new Nexus 7 has a full HD 1920 × 1200 pixel display

Hardware :

 

 The new Nexus device has a lot of hardware changes. The Tegra 3 processor is 01 Nexus 7, but the new Nexus 7 is a 1.5 GHz Qualcomm Snapdragon S4 Pro processor and GB of RAM.
It has a 3950 mAh battery, which is at 013 Nexus 7 is less than the 4235 mAh battery. But I have no reason to worry . MAh battery back-up battery is low, but the idea is not to be less than in previous years. Considering the internal memory of 16 GB and 32 GB's new Nexus 7 are two version for you.

Camera : 

 

The 013 Nexus 7's front camera are the same as before. The 1.2 Their megapixels. The new device has been added to the Nexus 5 megapixel rear camera  .

Price :

Depending on the configuration of the device, the Nexus has been out of the price of $ 229-349. The $ 349 price 3 GB LTE version will be available that can be 




Tuesday, September 24, 2013

File Chooser

In this post, you learn to implement a File Chooser in Android. Some apps such as text viewer, text editor, and other apps that allow the user to select a file from the Android to open should provide a dialog that the user can select the file easily. In Java, we have JFileChooser and in VB.NET or C# we have OpenFileDialog. However, in Android, i have not found a file chooser library to do such the same thing.
To begin, please open the Eclipse and create a new Android project called FileChooser. In this File Chooser implementation, i use the AlertDialog class to show a file chooser dialog. On the dialog, there are one ListView, and two Buttons. The ListView displays the files and directories. The first Button takes the user back up one level of the directories structure. The second Button is pushed to close the dialog.

FileChooser for Android



You no need to create a layout file for the dialog to show the ListView, and the two Buttons as these components will be added to the dialog by code in AndFileChooser.java file.
Each item of the ListView contains both icon and text. If the item represents the directory, the icon will be directory icon. Otherwise, it is the file icon. In default, the ListView provided by Android is simple ListView that its items show only text. To customize the ListView to display both icon and text, first to do is changing the layout file that is applied to each item of the ListView. The layout file in this File Chooser implementation is called listlayout.xml in layout directory. Its content is shown below.

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


<ImageView
    android:id="@+id/icon"
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:padding="5sp"
    android:contentDescription="iconimage"
 />

<TextView
    android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10sp"
        android:textSize="20sp"
        android:textColor="#0000ff"
        android:textStyle="bold" >
</TextView>
</LinearLayout>


As you see in the listlayout.xml file, there are two components in this layout. First one is the ImageView to display the icon of an item. The second component is TextView to display the text of the item.
You should note that this layout is not the layout of the ListView itselft. Instead, it is the layout of an item of the ListView. The ListView will be defined in code (int AndFileChooser.java).

Another layout file that you need to create is called selection_style.xml. This layout is applied to the selected item of the list. The selection_style.xml file is stored in the drawable directory. In this directory, you also need two small images--directory and file images. These images represent the directory and file icons that show on the ListView (see the picture above).

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
 
    <item>
        <shape>
            <gradient
                android:startColor="#dfdfdf"
                android:endColor="#dfdfdf"            
                android:angle="180" />
        </shape>      
    </item>
</selector>

Now take a look at the AndFileChooser. java file. This file contains a class called AndFileChooser. The AndroidFileChooser class can be used anywhere in your app to display the file chooser dialog.

AndFileChooser.java

package com.example.filechooser;
import java.io.File;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class AndFileChooser {
private int RESULT=0;
private static final int RESULT_OK=1;
private String path;
private Context context;
private  String att_path;
private ListView l;

AndFileChooser(String path, Context context){
this.path=path;
this.context=context;
}

public void show(){
//create a dialog to show a list of files and directories
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(true);
builder.setPositiveButton("OK", new OkOnClickListener());
builder.setNeutralButton("Up",null);
builder.setView(getList(path));
AlertDialog dialog = builder.create();      
dialog.show();
//override the default dialog default behavior when the Up button is pressed
dialog.getButton(Dialog.BUTTON_NEUTRAL).setOnClickListener(new View.OnClickListener() {

public void onClick(View arg0) {
upOneLevel();
}
});
}

private void upOneLevel(){
    //go back on directory
    path=path.substring(0, path.lastIndexOf("/"));
if(path.length()<=0)
path="/";
listFiles();
   }
   private final class OkOnClickListener implements DialogInterface.OnClickListener {
    public void onClick(DialogInterface dialog, int which) {
    RESULT=RESULT_OK;
    dialog.cancel();//close the dialog    
    }
   }
 
   private ListView getList(String path){  
    l=new ListView(context); //create new list object
    l.setBackgroundColor(Color.BLACK); //apply background to the ListView
    listFiles(); //add files and directories to the list for the first time
    l.setOnItemClickListener(new ItemList()); //register item click event
    return l;
   }  
 
 
   public void listFiles(){
   
    try{
    File f=new File(path);    
    if(f.isDirectory()){ //Check whether the path is a directory
    String[] contents=f.list();
    if(contents.length>0){ //list contents of the directory
    //ArrayAdapter<String> aa=new ArrayAdapter<String>(context,R.layout.listlayout,contents);
    ListAdapterModel aa=new ListAdapterModel(context,R.layout.listlayout,R.id.label,contents,path);
    l.setAdapter(aa);
    }
    else
    path=f.getParent(); //keep its parent directory for empty sub-directory
    //Toast.makeText(context,att_path, Toast.LENGTH_SHORT).show();
    }
    else if(f.isFile()){ //Otherwise, get the full path of the file and keep parent directories of the file.
    //This file will be attached to the email message
    att_path=f.getPath();
    //path=att_path.substring(0, att_path.lastIndexOf("/"));
    path=f.getParent();
    Toast.makeText(context,att_path, Toast.LENGTH_SHORT).show();
    }
    }catch(Exception e){e.printStackTrace();}  
   }
 
   private class ItemList implements OnItemClickListener{
   
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
     
    l.setSelector(R.drawable.selection_style); //apply background style to the selected item
    ViewGroup vg=(ViewGroup)view;
      String selectedItem = ((TextView) vg.findViewById(R.id.label)).getText().toString();
    path=path+"/"+selectedItem; //append the item to path
           listFiles();  //update files and directories of the list when a file or directory
       
      }
   }
 
   public String getFilePath(){
    if(RESULT==RESULT_OK)
    return att_path;
    else return null;
   }
}


The AndFileChooser class has the show method to display the file chooser dialog. In the show method, the Builder class that is a sub-class of the AlertDialog is used to create a dialog. To add an OK button to the dialog, you can use the setPositiveButton method of the Builder class. You will need to specify the text to display on the button (OK), and the click listener to this method. The OkOnClickListener class defines the click listener for the OK button.

private final class OkOnClickListener implements DialogInterface.OnClickListener {
    public void onClick(DialogInterface dialog, int which) {
       RESULT=RESULT_OK; //set the RESULT to RESULT_OK
       dialog.cancel();//close the dialog
     }
}


The click listener registers the OK button with the click event and performs action when the button is clicked. We also need one more button (Up) to take the user back up one level of the directories structure. The setNeutralButton is called to define this button. In Android, the dialog closes immediately when the user clicks any button on the dialog. However in the File Chooser app, when the user clicks the Up button, the dialog must not close. Instead, it takes the user back up one level. To do what we want, we need to change this default behavior by setting null to its click listener when it is defined and later overriding its setOnClickListener method.

To display the ListView on the dialog, you need to use the setView method of the Builder. In this app, our ListView object is defined in the getList(String path) method. This method returns a ListView object with items. Its items are files and directories of the parent directory specified by the path argument. In the getList method, the listFiles method is called to retrieve the contents (files and directories) of the input path and show them on the list. When the user selects an directory item of the ListView, the contents of the directory will be listed (overriding the previous contents of the ListView). To perform this action, you need to register the ListView with the item click listener by using the setOnItemClickListener method. The ItemList class defines the item click listener for the ListView.

private class ItemList implements OnItemClickListener{

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    l.setSelector(R.drawable.selection_style); //apply background style to the selected item
    ViewGroup vg=(ViewGroup)view;
    String selectedItem = ((TextView) vg.findViewById(R.id.label)).getText().toString();
    path=path+"/"+selectedItem; //append the item to path
    listFiles(); //update files and directories of the list when a file or directory

    }
}
In the onItemClick method, the selection style is applied to the selected item of the ListView by using the setSelector method. You need to pass the layout that applies the selection style to the selected item (selection_style.xml). When an item of the ListView is selected, you can access this item by using the view argument. As you already know, an item of the ListView contains two parts--image and text. Each part is represented by different component (ImageView and TextView), So you need to cast the view to a ViewGroup object. Within the ViewGroup object, you can refer to any component that it contains.

The path variable is updated to reflect the current path of the selected file or directory. The listFiles method is called again to update the contents of the ListView.
In the listFiles method, a File object is created to point to the current path so you can determine that the current path is directory or file. If it is a directory, its contents will be listed. Otherwise, the current file path is captured and the path variable is updated to its parent directory. The selected path of the file can be accessed by using the getPath method.

In this method, you also see a class called ListAdapterModel. The ListAdapterModel is a class that extends the ArrayAdapter class. As you already know from my previous post (Web Downloader), ArrayAdapter is used as data source of the ListView. If an item of the ListView has only one text component, there is no need to extend the ArrayAdapter. However, in this app, an item of the ListView contains two parts--image and text. So, the ArrayAdapter has to be extended. To enable the item to display both image and text, you need to override the getView method of the ArrayAdapter class. Below is the content of the ListAdapterModel.java file.

ListAdapterModel.java

package com.example.filechooser;
import java.io.File;
import android.content.Context;
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 ListAdapterModel extends ArrayAdapter<String>{
int groupid;
String[] names;
Context context;
String path;
public ListAdapterModel(Context context, int vg, int id, String[] names, String parentPath){
super(context,vg, id, names);
this.context=context;
groupid=vg;
this.names=names;
this.path=parentPath;
}
public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View itemView = inflater.inflate(groupid, parent, false);
        ImageView imageView = (ImageView) itemView.findViewById(R.id.icon);
        TextView textView = (TextView) itemView.findViewById(R.id.label);
        String item=names[position];
        textView.setText(item);
        File f=new File(path+"/"+item);
        if(f.isDirectory())
        imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.diricon));
        else
        imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.fileicon));
        return itemView;
     
}

}


Now, you have set up the FileChooser dialog. It is ready to use in your activity. For testing, in the onStart method of the MainActivity class, you can create an instance of the AndFileChooser class and call its show method to display the dialog.

MainActivity.java file

package com.example.filechooser;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends Activity {

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

    protected void onStart(){
    super.onStart();
    AndFileChooser filechooser=new AndFileChooser("/",this);
    filechooser.show();
   
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
 
}


Don't forget to run the app, otherwise the file chooser does not display.


FileChooser run on Emulator

Download apk file of the FileChooser app