I have a listview with and image and per row 2 lines. in the first line i have a simple text stored in a array, the second line also, but what i would like to know how it can change dynamically the second line with the installed or not app status.
this is the code:
String[] tools = new String[] { "tool 1", "tool 2", "tool 3", "tool 4", "tool 5" };
// Array integer que apunta a las imagenes en /res/drawable-ldpi/
int[] flags = new int[]{
R.drawable.image1,
R.drawable.image2,
R.drawable.image3,
R.drawable.image4,
R.drawable.image5
};
// Array string donde van la descripcion
String[] status = new String[]{
"Status",
"Status",
"Status",
"Status",
"Status"
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.anonimato);
List<HashMap<String,String>> aList = new ArrayList<HashMap<String,String>>();
for(int i=0;i<5;i++){
HashMap<String, String> hm = new HashMap<String,String>();
hm.put("txt", tools[i]);
hm.put("cur", status[i]);
hm.put("flag", Integer.toString(flags[i]) );
aList.add(hm);
}
String[] from = { "flag","txt","cur" };
int[] to = { R.id.flag,R.id.txt,R.id.cur};
SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), aList, R.layout.listview_layout, from, to);
With this link How to check programmatically if an application is installed or not in Android? i have the function to know if the app is installed or not, but how i can load it in the status array? and how i add it to my source?