1
Hai朋友我是Android的新手..如何從ArrayAdapter類導航到另一個活動類。我不知道如何導航。我知道使用了「intent」關鍵字導航一個活動到另一個活動..但現在我使用ArrayAdapter類,如果我使用「intent」關鍵字來導航另一個活動,我會得到錯誤。如何從Android中的ArrayAdapter類調用下一頁類
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;
}
}
//我上無法使用意圖在這個類..請給予解決