Showing posts with label gallery. Show all posts
Showing posts with label gallery. Show all posts

Android Gallery Control

In Android the Gallery control is a selection control that displays items in a horizontal gallery. the items in the gallery appear beside each other. they can appear separated by a pre-defined space.

remember that there is a sample demo application for the gallery to download at the end of the post

we can use the gallery to display String items using a simple ArrayAdapter.
so lets see how to create a gallery that displays the word "Hello" in several languages:

the layout:
01<?xml version="1.0" encoding="utf-8"?>
02<LinearLayout >="http://schemas.android.com/apk/res/android"
03    android:orientation="vertical"
04    android:layout_width="fill_parent"
05    android:layout_height="fill_parent"
06    >
07<TextView 
08    android:layout_width="fill_parent"
09    android:layout_height="wrap_content"
10    android:text="Gallery Demo"
11    />
12    <Gallery
13    android:id="@+id/gallery"
14    android:layout_width="fill_parent"
15    android:layout_height="wrap_content"
16    android:gravity="center_horizontal"
17    android:spacing="100px"
18     
19    />
20</LinearLayout>

and in the OnCreate method
01@Override
02    public void onCreate(Bundle savedInstanceState) {
03        super.onCreate(savedInstanceState);
04        setContentView(R.layout.main);
05        gallery=(Gallery)findViewById(R.id.gallery);
06        //String array holding the values
07        String [] text=new String[]{"Hello","Hi","Alloha","Bonjour","Hallo","¡Hola"};
08        //Array adapter to display our values in the gallery control
09        ArrayAdapter<string> arr=new ArrayAdapter<string>(this, android.R.layout.simple_gallery_item, text);
10gallery.setAdapter(arr);
11}
12</string></string>

the gallery will be like this

we can increse the spacing between the items by increasing the value of android:spacing property.

we can display a scroll bar to indicate the position of the current selected item in the gallery like this:
01<Gallery
02    android:id="@+id/gallery"
03    android:layout_width="fill_parent"
04    android:layout_height="wrap_content"
05    android:gravity="center_horizontal"
06    android:spacing="100px"
07    android:scrollbars="horizontal"
08    android:scrollbarFadeDuration="0"
09    android:scrollX="100px"
10    />



setting the android:scrollbarFadeDuration="0" makes the scroll bar always visible.

The android:scrollX property defines the initial scroll offset of the scroll bar which is the initial distance that the gallery is scrolled for.

Handling Gallery Events
since the gallery is a selction Control (a adapter view) so it can register a OnItemSelectedListener to handle the selection of items within the gallery.

01final String [] text=new String[]{"Hello","Hi","Alloha","Bonjour","Hallo","¡Hola"};
02gallery.setOnItemSelectedListener(new OnItemSelectedListener() {
03 
04   @Override
05   public void onItemSelected(AdapterView parent, View view,
06     int position, long id) {
07    // TODO Auto-generated method stub
08    TextView txt=(TextView)findViewById(R.id.txt);
09    txt.setText(text[position].toString());
10   }
11 
12   @Override
13   public void onNothingSelected(AdapterView parent) {
14    // TODO Auto-generated method stub
15     
16   }
17  });


now the final step is to add two navigation buttons: Next and Previous to navigate throught the items in the gallery.
the layout is gonna be like this:
01<?xml version="1.0" encoding="utf-8"?>
02<LinearLayout >="http://schemas.android.com/apk/res/android"
03    android:orientation="vertical"
04    android:layout_width="fill_parent"
05    android:layout_height="fill_parent"
06    >
07<TextView 
08    android:layout_width="fill_parent"
09    android:layout_height="wrap_content"
10    android:text="Gallery Demo"
11    android:id="@+id/txt"
12    />
13    <Gallery
14    android:id="@+id/gallery"
15    android:layout_width="fill_parent"
16    android:layout_height="wrap_content"
17    android:gravity="center_horizontal"
18    android:spacing="100px"
19    android:scrollbars="horizontal"
20    android:scrollbarFadeDuration="0"
21    android:scrollX="100px"
22    />
23    <LinearLayout
24     android:layout_width="fill_parent"
25     android:layout_height="wrap_content"
26     android:orientation="horizontal"
27     android:layout_marginTop="5px"
28     >   
29     <Button
30     android:text="Previous"
31     android:layout_width="wrap_content"
32     android:layout_height="wrap_content"
33     android:id="@+id/btnPrev"
34     android:onClick="onClick"
35      />
36      <Button
37     android:text="Next"
38     android:layout_width="wrap_content"
39     android:layout_height="wrap_content"
40     android:id="@+id/btnNext"
41     android:onClick="onClick"
42      />
43 
44    </LinearLayout>
45     
46</LinearLayout>

now in order to keep track of the index of the currently selected item we need to define two variables
1//Variable to store the number of items in the gallery
2 int ItemsInGallery=0;
3 int CurrentIndex=0;

and the navigation buttons click handlers:
01@Override
02 public void onClick(View v) {
03  // TODO Auto-generated method stub
04  switch(v.getId())
05  {
06  case R.id.btnNext:
07   //Increase the index
08   CurrentIndex++;
09   //if reached the end of the gallery, then start from the first item
10   if(CurrentIndex>ItemsInGallery-1)
11    CurrentIndex=0;
12   gallery.setSelection(CurrentIndex,true);
13   txt.setText(String.valueOf(CurrentIndex));
14   break;
15  case R.id.btnPrev:
16   //Decrease the index
17   CurrentIndex=CurrentIndex-1;
18   //If reached the first item, then return to the last item in the gallery
19   if(CurrentIndex<0)
20    CurrentIndex=ItemsInGallery-1;
21   gallery.setSelection(CurrentIndex,true);
22   txt.setText(String.valueOf(CurrentIndex));
23   break;
24  }
25 }
you can download a sample program from here


Android Apk
Read More..

Gallery Lock Pro 4 2 1 Apk Download

40

 

 

Hide Pictures/Videos!

Chosen of the App of the twelve months by Occasions Magazine!

Gallery Lock professional four.2.1 Apk manages photos ANd in addition video clips by in person concealment them and in addition its an app WHO is totally required for defense of personal confidentiality. This product is among one among the foremost widespread apps within the world and is also thought of one among the highest 10 apps sold-out on Google Market.

Features
• Administration of images by individual folders
• may be used for every photos and in addition videos
• may be handily used with alternative gallery apps
• concealing mode provided (a work that hides the icons)
• attractive design
• Pattern lock provided

# (Important!) Right before removing the fatless version, undo the quilt up work of the photos together with the net videos. If you uninstall the program while not having undoing the hide operate, the photos and on-line videos may well be missing.

# Google will create a pre-charge of $1 the first time a deal is formed upon Google Market to see the information on your mastercard. this might be misunderstood since being charged a pair of times but theres no need to worry since the pre-charge cant seem in your regular report.

# its suggested that you get the code shortly once checking to ascertain whether or not the free assessment fatless version runs properly.

# “Outgoing Call” permission is needed for concealing Mode.

# technique to recuperate photos once problems happen.

If just in case for a few reason Gallery Lock professional four.2.1 Apk doesnt run, knowledge recovery will feel created by adopting the tactic below.

1) Uninstall Gallery Lock
2) transfer Gallery Lock from all the Market and in addition install it.
3) Go surroundings within the Gallery Lock, regulator “Find/Recover Lost files” menu.
4) The lacking files is rehabilitated to /mnt/sdcard/DCIM/recover route.
5) run default Gallery application and check whether or not those knowledge ar recovered properly.

# Kindly send a powerful e-mail for any necessary queries that youve got. The developer of the code doesnt have consent to reply to comments here.

(KW:photo valut,video valut,photovault,videovault,image lock,photo lock,image dependable,photograph low risk,protector,stealth,hide image,kii,stock,Keep Dependable,kii dependable,cover up motion-picture show,conceal impression,vault,hide it,Hide Photos in Stocks Application,mysterious gallery,gallery,privacy,gallerylock,gallery personal,gallery hide,cover up gallery,quick image,quick,ロック).

Download Link 

Android Apk
Read More..