AIDE Tutorial - 13.1 Spinner in Java
Watch the videoMainActivity.Java
package com.kcgroup.SIJ;
import android.app.*;
import android.os.*;
import android.widget.*;
public class MainActivity extends Activity
{ @Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Spinner spin=(Spinner)findViewById(R.id.mainSpinner);
String[] countries={
"Nepal","India","China","USA","UK",};
ArrayAdapter adpater=new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item,countries);
spin.setAdapter(adpater); }}
Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:text="Countries Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:text="Countries Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/mainSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Related articles:
1. AIDE Tutorial-13 Spinner
script data-cfasync='false' type='text/javascript' src='//p24789.clksite.com/adServe/banners?tid=24789_34790_14'>
android:id="@+id/mainSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Related articles:
1. AIDE Tutorial-13 Spinner
script data-cfasync='false' type='text/javascript' src='//p24789.clksite.com/adServe/banners?tid=24789_34790_14'>
0 comments:
Post a Comment