When I trying to use Gallery widgets . I have a issue with it .
This class was deprecated in API level 16. This widget is no longer supported. Other horizontally scrolling widgets include HorizontalScrollView and ViewPager from the support library.
This is my code
String [] text=new String[]{"Hello","Hi","Alloha",
"Bonjour","Hallo","¡Hola"};
Gallery gallery;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery);
gallery = (Gallery)findViewById(R.id.gallery1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_gallery_item,text);
gallery.setAdapter(adapter);
}
and activity_gallery.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".GalleryActivity" >
<Gallery
android:id="@+id/gallery1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
It displays blank . I'm using android 4.2.2 API 17 . I don't know what happen . Anybody can help me !!!!