我需要导航到此myadapter类中的另一个活动。有人可以告诉我如何更换吐司以导航到另一个活动?谢谢。
这是我的代码:
public class MyAdapter extends BaseAdapter implements Filterable {
Context c;
ArrayList<Movie> movies;
LayoutInflater inflater;
ArrayList<Movie> filterList;
CustomFilter filter;
public MyAdapter(Context c, ArrayList<Movie> movies) {
this.c = c;
this.movies = movies;
this.filterList=movies;
}
//TOTLA NUM OF MOVIES
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if(inflater==null)
{
inflater=(LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
//PERFORM INFLATION
if(convertView==null)
{
convertView=inflater.inflate(R.layout.model,null);
}
//BIND DATA TO VIEWS
MyViewHolder holder=new MyViewHolder(convertView);
holder.nameTxt.setText(movies.get(position).getName());
holder.img.setImageResource(movies.get(position).getImage());
holder.setItemClickListener(new ItemClickListener() {
@Override
public void onItemClick(View v) {
Toast.makeText(c,movies.get(position).getName(),Toast.LENGTH_SHORT).show();
}
});
//RETURN A ROW
return convertView;
}
@Override
public Filter getFilter() {
if(filter==null)
{
filter=new CustomFilter(filterList,this);
}
return filter;
}
答案 0 :(得分:0)
对我有用
Intent intent = new Intent(this,MyActivity.class);