Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Android Gallery Control

| 0 comments |
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..

Wave Control Pro Apk 2 80 Download

| 0 comments |
Wave-Control-Pro-Apktablets.com_-500x250

Wave Control Pro Apk 2.80 Download


Requirement:2.2 and up

Overview: Reduce Personal Tunes Through A Tide of one’s Control!

Reduce Their Music Which Has A Tide of Your Control!

Applications their distance sensor to your contact to provide control of personal music playback with waving every give your current phone. No need to turn on personal filter as well as touching your own telephone anyway!

Expert Services:

Absolutely No Ads

Increased Instructions

Allocate What Kind Of Touch Performs Which In Turn Command

Not Far Off:

Further services – feel free to mail any kind of requests you might have

Enhance the UI

Intuitive, merely tide complete give that sensor (normally found just simply next to the earpiece on your cell).

Holding everything there will Pause/continue

A person tide all around moves to the Next tune

Two surf over may go toward preceding Song

3 times (should be rapidly) definitely will stop or Resume that the handles

Remember to facilitate Headset link Control as part of your user of choice

Files:

You will find theres tiny not as much as an additional to register your current waves.

Advice for its hover touch: so long as you push your own give absent straight away it’ll sign-up each tide

After a good action, there exists a 1 second put off in the past another gesture will be registered

Will most likely hire just about any device who accepts headset (medium key) handles

In the event the display was off or another application is during attention, phone vibrates once about stop reduce then double on top of cv manages

Practise ones wave tricks simply by monitoring on “latest move”

Should you be applying for one more device addressing on instructions, find out if your software comes with the solution to turn off headset link controls

Whats new in Wave Control Pro 2.80 apk download:

-Extra assist as Samsung Galaxy take note 3 Gesture Sensor

-Insect repairs

Wave Control Pro 2.80 Apk doesn’t have promotions

Wave Control Pro Apk 2.80 Download

Google Play Link

 

Download Link

Android Apk
Read More..