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 7956629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:03:05+00:00 2026-06-04T04:03:05+00:00

I have created an app in which I had use SPenSDK to create image

  • 0

I have created an app in which I had use SPenSDK to create image using canvasView. Once I create images in the canvas view, I save the image in the SD Card /mnt/sdcard/SmemoExample location. Now I want to display all the images that are stored here /mnt/sdcard/SmemoExample in my ListView.

But I am not able to find any solution for that.

List_view.xml file

<?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">
<ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="1"/>
<Button
    android:id="@+id/button1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:text="Clear Cache"/>
</LinearLayout>

item.xml file

<?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">
<ImageView
  android:id="@+id/image"
  android:layout_width="50dip"
  android:layout_height="50dip" android:src="@drawable/ic_launcher"   android:scaleType="centerCrop"/>
<TextView
  android:id="@+id/text"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_weight="1" android:layout_gravity="left|center_vertical" android:textSize="20dip" android:layout_marginLeft="10dip"/>
</LinearLayout>

java code

public class ListActivity extends Activity {
private String[] mFileStrings;

private File[] listFile;

ListView list;

ImageAdapter adapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    
     File file = new File(CanvasActivity.DEFAULT_APP_IMAGEDATA_DIRECTORY);
     
     if (file.isDirectory()) {
         listFile = file.listFiles();
         mFileStrings = new String[listFile.length];

         for (int i = 0; i < listFile.length; i++) {
             mFileStrings[i] = listFile[i].getAbsolutePath();
         }
     }

     list = (ListView) findViewById(R.id.list);
     adapter = new ImageAdapter(this, mFileStrings);
     list.setAdapter(adapter);
}

public class ImageAdapter extends BaseAdapter {
    private Activity activity;
    private String[] data;
    private LayoutInflater inflater=null;
    public ImageLoader imageLoader; 
    
    public ImageAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }
    
    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}
}
  • 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-04T04:03:06+00:00Added an answer on June 4, 2026 at 4:03 am

    Answer is for reference of the above question and other answer.

    Just take a look at LazyList project. Now we make a some modification in it..

    MainActivity.java

    private String[] mFileStrings;
    private File[] listFile;
    
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            File file = new File("<Directory path from sdcard>");
    
            if (file.isDirectory())
            {
                listFile = file.listFiles();
                mFileStrings = new String[listFile.length];
    
                for (int i = 0; i < listFile.length; i++)
                {
                    mFileStrings[i] = listFile[i].getAbsolutePath();
                }
            }
    
            list = (ListView) findViewById(R.id.list);
            adapter = new LazyAdapter(this, mFileStrings);
            list.setAdapter(adapter);
    
            Button b = (Button) findViewById(R.id.button1);
            b.setOnClickListener(listener);
        }
    

    in ImageLoader.java

    private Bitmap getBitmap(String url)
        {
            File f = new File(url);
    
            //from SD cache
            Bitmap b = decodeFile(f);
            if (b != null)
            {
                return b;
            }
            return null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a FB App which I created using Fandjango. It works fine if
I have created an animated game app, In which I am using NSTimer to
I have created an app which allows users to buy non-consumable content. The retrieving-ids-payment-process
I have created an app which allows users to buy non-consumable content. The retrieving-ids-payment-process
I have created an app in which I have used achartengine to construct the
I've created an app which contains form and that have to filled up in
I have created an app that uses NSTimer, which gets triggered each second. My
I have created a library which reads the app.config file and gets the type
I have to create an app in which I must set a date and
I have managed to create a simple app which deletes (bypassing the recycle bin)

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.