0
I need to delete an element of my Listview and I’m in trouble my code is this
Host = new String[] { "Host1 ", "Host2", "Host3"};
Descricao = new String[] { "Estado do Host", "Estado do Host", "Host" };
Status = new String[]{"DOWN","UNREACHABLE","DOWN"};
adapter = new ListViewAdpterInicial(getActivity().getBaseContext(),Host,Descricao,Status);
list.setAdapter(adapter);
listviewAdpterInitial
public class ListViewAdpterInicial extends BaseAdapter {
Context context;
String[] Host;
String[] Descricao;
String[] Status;
public ListViewAdpterInicial(Context context, String[] host, String[] descricao, String[] status) {
this.context = context;
this.Host = host;
this.Descricao = descricao;
this.Status = status;
}
@Override
public int getCount() {
return Host.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
TextView txtHost;
TextView txtDescricao;
TextView txtStatus;
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.texto_inicial_host, parent, false);
txtHost = (TextView) itemView.findViewById(R.id.txt_host_inicial);
txtDescricao = (TextView) itemView.findViewById(R.id.txt_host_descricao);
txtStatus = (TextView)itemView.findViewById(R.id.txt_host_status);
txtHost.setText(Host[position]);
txtDescricao.setText(Descricao[position]);
txtStatus.setText(Status[position]);
return itemView;
}}
How would I do for ex: delete Element 2 from this List