Search code examples
androidpasswordstextviewandroid-wificlickable

How make textview clickable and open wifi password popup if protected?


i've created a list of the wifi connections. This list is inside a textview. How can i make the textview clickable and onclick over a connection open the popup to insert the password if protected? Thanks


Solution

  • If you have a whole inside a textview, it will be very hard for you to detect onClick, maybe you should try using a standard ListView with an adapter. Here you will find an easy tutorial.

    set an adapter to a listview like this one:

    <ListView
        android:id="@+id/networks_list"
        style="@android:style/Theme.Holo.Light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </ListView>
    

    Inside the adapter inflate something like the following, add elements as needed:

    <TextView
            android:id="@+id/net_name"
            style="@android:style/TextAppearance.Holo.Medium.Inverse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="" />