Create a Photo Gallery App for Android for Local Images

12,059

Solution 1

Check out below Links for the Live wallpaper:

1) PhotoGalleryLive wallpaper
2) Gallery Wallpaper
3) Android-wallpaper-slideshow

Solution 2

This is how i do image view for my app...

import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;

public class CertDisplay extends Activity {
    Integer[] pics = {
            R.drawable.cert1,
            R.drawable.cert2,
            R.drawable.cert3,
            R.drawable.cert4,
            R.drawable.cert5
    };
    ImageView imageView;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.certificate);            
        Gallery ga = (Gallery)findViewById(R.id.Gallery01);
        ga.setAdapter(new ImageAdapter(this));
    }

    public class ImageAdapter extends BaseAdapter {

        private Context ctx;
        int imageBackground;

        public ImageAdapter(Context c) {
            ctx = c;
            TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1);
            imageBackground = ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
            ta.recycle();
        }

        @Override
        public int getCount() {

            return pics.length;
        }

        @Override
        public Object getItem(int arg0) {

            return arg0;
        }

        @Override
        public long getItemId(int arg0) {

            return arg0;
        }

        @Override
        public View getView(int arg0, View arg1, ViewGroup arg2) {
            ImageView iv = new ImageView(ctx);
            iv.setImageResource(pics[arg0]);
            iv.setScaleType(ImageView.ScaleType.FIT_XY);
            //iv.setLayoutParams(new Gallery.LayoutParams(750,1020));
            iv.setBackgroundResource(imageBackground);
            return iv;
        }

    }
}
Share:
12,059

Related videos on Youtube

thowzif
Author by

thowzif

Pro Web Desigher Amature Mobile App Developer Part time @ McDonalds

Updated on June 04, 2022

Comments

  • thowzif
    thowzif about 2 years

    I want to create a photo gallery app for android which has the following functionality,

    • "SET AS WALLPAPER" Option
    • Navigation Buttons (Left - Right)

    Its more like a live wallpaper. I need to know if there are any source codes out there to help me create this quickly.

    I have knowledge on HTML5 CSS3 and in PHP(if it helps) :)

    Useful help will be highly appreciated.

  • thowzif
    thowzif over 11 years
    Thanks Grishu, i checked it but is there any simple solutions like editing the source and replacing the wallpapers like that?
  • thowzif
    thowzif over 11 years
    Sorry i have no knowledge in programming java
  • thowzif
    thowzif over 11 years
    Thanks for the quick reply, Sorry i have no knowledge in programming java
  • GrIsHu
    GrIsHu over 11 years
    You can check out the demos and edit that as per your requirements its open source demos. :)