Thanks for your reply.........
Can you explain little more..?
On Saturday, 1 September 2012 18:12:00 UTC+5:30, Haris wrote:
>
>
> Hai...........
>
> I am writing an application something like list view with toggle
> button.......
> Here is my source code.......
>
>
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> ArrayAdapter<String> adapter=new
> ArrayAdapter<String>(getApplicationContext(),R.layout.main,R.id.textView1,getResources().getStringArray(R.array.Strings));
> setListAdapter(adapter);
>
> }
> @Override
> protected void onListItemClick(ListView l, View v, int position, long id)
> {
> String item = (String) getListAdapter().getItem(position);
> Toast.makeText(this, item+" selected", Toast.LENGTH_LONG).show();
> }
>
> And I am importing the list from string resources......and my sring.xml is
>
> <resources>
> <string name="app_name">MyListViewWithToggleButton</string>
> <string name="hello_world">Hello world!</string>
> <string name="menu_settings">Settings</string>
> <string name="title_activity_main">MyListViewWithToggle</string>
> <string name="On_Off">ON/OFF</string>
>
>
> <string-array name="Strings">
>
> <item >Relay1</item>
> <item >Relay2</item>
> <item >Relay3</item>
> <item >Relay4</item>
> <item >Relay5</item>
> <item >Relay6</item>
> <item >Relay7</item>
> <item >Relay8</item>
> </string-array>
> </resources>
>
> And in mu main.xml I am using a text view and toggle button
>
>
> <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" >
>
> <TextView
> android:id="@+id/textView1"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_alignParentLeft="true"
> android:layout_toLeftOf="@+id/toggleButton1"
> android:textSize="20dp" >
> </TextView>
>
>
> <ToggleButton
> android:id="@+id/toggleButton1"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:layout_alignParentRight="true"
> android:layout_marginLeft="4dp"
> android:layout_marginRight="10dp"
> android:text="@string/On_Off" >
>
> </ToggleButton>
>
>
> </RelativeLayout>
>
> when I click the toggle button it showing On and off...
> But when I click on the list I am not getting any responses......
>
> For my application I need to send some data while pressing the toggle
> button with respect to button condtion....
>
> thanks...............
>
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en