Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:50:36+00:00 2026-06-03T15:50:36+00:00

I want to implement a file browser in my app. I saw code for

  • 0

I want to implement a file browser in my app. I saw code for a file browser. But in all those examples the dir /files are listed as a lisrview. I am want to give a gridview display in my app. The folders / files will be listed in a grid. On clickikng a folder , it will open the next level grid.

I didnt see any implementation supporting this.
If you have any reference please share

thanks for the time and support

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:50:39+00:00Added an answer on June 3, 2026 at 3:50 pm

    Adding my code here for anyones future reference

    public class FileBrowserActivity extends Activity {
    GridView gridView;
    
    
    
    public static List<FileBrowserItem> gridItemsList;
    public static String name;
    String root;
    String TAG= "FileBrowser";
    public static boolean multiSelectFlag = false;
    @Override
    public void onCreate(Bundle savedInstanceState) {
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gridview);
         root = getIntent().getExtras().getString("rootpath");
    
        Log.i(TAG,"path:"+ root);
    
        getGridItemsList();
        gridView = (GridView) findViewById(R.id.gridView1);
    
        gridView.setAdapter(new FileBrowserGridViewAdapter(this));
    
    }
    
    private void getGridItemsList() {
        gridItemsList = new ArrayList<FileBrowserItem>();
         File file;
        file = new File(root);
        File list[] = file.listFiles();
        if(list.length == 0){
            Toast.makeText(getApplicationContext(), "Empty Folde", Toast.LENGTH_SHORT).show();
        }
        for (int i = 0; i < list.length; i++) {
            FileBrowserItem item = new FileBrowserItem();
            File temp_file = new File(file.getAbsolutePath(),list[i].getName());
            item.setPath( file.getAbsolutePath()+"/"+list[i].getName());
            item.setName(list[i].getName());
            //Log.i(TAG,i + item.value + item.name);
            if ( temp_file.listFiles() != null) {
                item.setType(FileBrowserItem.DIRECTORY_TYPE)  ;
            } else {
                item.setType(FileBrowserItem.FILE_TYPE)  ;
            } 
            gridItemsList.add(item);
        }
    
    }
    @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if ((keyCode == KeyEvent.KEYCODE_BACK)) {
             root = new File(root).getParent();
             Log.i(TAG,"back"+root);
             getGridItemsList();
             finish();
             return true;
         } else {
             return super.onKeyDown(keyCode, event);
         }
     }
    

    }

    public View getView(final int position, View convertView, ViewGroup parent) {
    
        ViewHolder holder;
        if (convertView == null) {
            LayoutInflater mInflater = (LayoutInflater) mContext
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = mInflater.inflate(R.layout.grid_item, null);
            holder = new ViewHolder();
            holder.text1 = (TextView) convertView
                    .findViewById(R.id.grid_item_label);
            holder.image = (ImageView) convertView
                    .findViewById(R.id.grid_item_image);
            holder.checkBox= (CheckBox) convertView
                    .findViewById(R.id.checkBox);
    
            holder.image.setOnClickListener(new View.OnClickListener() {
    
                public void onClick(View view) {
                    Log.d("onClick", "position [" + position + "]");
    
                    if (FileBrowserActivity.gridItemsList.get(position)
                            .getType() == FileBrowserItem.DIRECTORY_TYPE) {
                        Intent intent = new Intent(mContext,
                                FileBrowserActivity.class);
                        intent.putExtra("rootpath",
                                FileBrowserActivity.gridItemsList.get(position)
                                        .getPath());
                        mContext.startActivity(intent);
                    }
                }
            });
            convertView.setTag(holder);
        } else {
    
            holder = (ViewHolder) convertView.getTag();
    
        }
        Log.i(TAG, "Position" + position);
        Log.i(TAG, FileBrowserActivity.gridItemsList.get(position).getName());
        holder.text1.setText(FileBrowserActivity.gridItemsList.get(position)
                .getName());
        holder.image
                .setImageResource(getImageIcon(FileBrowserActivity.gridItemsList
                        .get(position).getType()));
        if(FileBrowserActivity.multiSelectFlag){
            holder.checkBox.setVisibility(View.VISIBLE);
        }
        else{
            holder.checkBox.setVisibility(View.GONE);
        }
        return convertView;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I want to implement is by clicking attach a file, a file browser
I want to implement file uploading with behaviour which is commonly seen in various
I want to implement OSGI bundle with JSF pages - WAB file, which can
I want to implement dynamic, client side file generation in javascript. Is it possible?
I want implement in my software solution an VBA editor but in c# 3.0.
I want to implement a function in the base class but I also want
Let's say I have the following code in my configure.zcml file. I want my
How do i stop the browser following to the file in jquery? i want
I want to implement a multi file upload I was thinking if its possible
I'm currently trying to implement some kind of file browser / explorer into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.