I need to modify my code to make it show the text with image not to change the whole code to another one with image function:
This is my code for images:
int[] imgs = new int[]
{
R.drawable.wifi,
R.drawable.bluetooth,
R.drawable.usb,
R.drawable.cloud,
R.drawable.remote,
};
And this is my ListView code:
listView = (ListView) findViewById(R.id.operations);
listView.setTextFilterEnabled(true);
String[] values = new String[]
{"Nearby Wifi",
"Nearby Blutooth",
"Direct USB Connected",
"Google Cloud Print",
"Printer Remote"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.custom_listview, android.R.id.text1, values);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
int itemPosition = position;
String itemValue = (String) listView.getItemAtPosition(position);
//if condition
}
});
And this is my custom_listview
:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="16dp"
android:textColor="@android:color/black"
android:textStyle="bold"
/>
How to modify it to show the text with the image?