2
I would like to know how I could do to call another Activity, through a list item where the data is used from the site parse.com. 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;
}
}
Your difficulty lies in knowing how to create a task with Asynctask to call the service, how to pass something from a Activity to another or what exactly?
– Paulo Rodrigues
@Paulo Rodrigues. I have an Activity that contains a listview that has your data stored on the site parse.com. The problem is I have an Activity with the name of the pizzerias on a list and I also have an Activity with the menu of each pizzeria. Hence what happens is that I cannot associate the data that is pulled from parse.com to call the correct Activity. For example, a list with several names of Pizzerias: PIZZERIA CAPRICHO calls Activity MENU CAPRICHO and PIZZERIA FAT calls Activity MENU FAT...
– Rony Sueliton