Hai Friends 我是 Android 的新手 ..如何从 ArrayAdapter 类导航到另一个活动类。我不知道如何导航。我知道“intent”关键字用于将一个活动导航到另一个活动..但现在我使用 ArrayAdapter 类,如果我使用“intent”关键字导航另一个活动,我会出错。
package org.ajsquare.test;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Color;
import android.sax.StartElementListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import android.widget.Toast;
public class Teamname extends ArrayAdapter<String>
{
private LayoutInflater mInflater;
private String[] mStrings;
private TypedArray mimages;
String mteam=null;
private int mViewResourceId;
Context c;
public Teamname(Context context, int textViewResourceId,TypedArray images,String[] test) {
super(context, textViewResourceId,test);
c=context;
mimages=images;
mViewResourceId=textViewResourceId;
mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mStrings=test;
}
public int getCount()
{
return mStrings.length;
}
public String getId(int position)
{
return mStrings[position];
}
public long getItemId(int position)
{
return 0;
}
public View getView(final int position, View convertview, ViewGroup parent)
{
convertview=mInflater.inflate(mViewResourceId, null);
ImageView imageView=(ImageView)convertview.findViewById(R.id.image_teamname);
imageView.setImageDrawable(mimages.getDrawable(position));
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
System.out.println(position);
//Intent intent=new Intent(Teamname.this,Team_details.class);// i am getting error from this line
//startActivity(this);
}
});
return convertview;
}
}
//我不能在这个类中使用意图..请给出解决方案