I would like to know how I could do to call another activity through an item in the list where the data is used from the parse.com site. For example, I have this code:
public class ListViewAdapterPizzarias extends BaseAdapter {
// Declare Variables
Context context;
LayoutInflater inflater;
ImageLoader imageLoader;
private List<WorldPopulation> worldpopulationlist = null;
private ArrayList<WorldPopulation> arraylist;
public ListViewAdapterPizzarias(Context context,
List<WorldPopulation> worldpopulationlist) {
this.context = context;
this.worldpopulationlist = worldpopulationlist;
inflater = LayoutInflater.from(context);
this.arraylist = new ArrayList<WorldPopulation>();
this.arraylist.addAll(worldpopulationlist);
imageLoader = new ImageLoader(context);
}
public class ViewHolder {
TextView nome;
TextView telefone;
TextView endereco;
TextView status;
}
@Override
public int getCount() {
return worldpopulationlist.size();
}
@Override
public Object getItem(int position) {
return worldpopulationlist.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
public View getView(final int position, View view, ViewGroup parent) {
final ViewHolder holder;
if (view == null) {
holder = new ViewHolder();
view = inflater.inflate(R.layout.item_lista_pizzarias, null);
// Locate the TextViews in listview_item.xml
holder.nome = (TextView) view.findViewById(R.id.nome);
holder.endereco = (TextView) view.findViewById(R.id.endereco);
holder.telefone = (TextView) view.findViewById(R.id.telefone);
holder.status = (TextView) view.findViewById(R.id.status);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
// Set the results into TextViews
holder.nome.setText(worldpopulationlist.get(position).getNome());
holder.endereco.setText(worldpopulationlist.get(position).getEndereco());
holder.telefone.setText(worldpopulationlist.get(position).getTelefone());
holder.status.setText(worldpopulationlist.get(position).getStatus());
///teste
// Listen for ListView Item Click
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// Send single item click data to SingleItemView Class
Intent intent = new Intent(context, MainActivity.class);
//O que colocar aqui para buscar o dado do site parse.com e chamar a outra activity?
}
});
return view;
}
}