Dude..
In intent.setClass(), pass the first parameter as the activity context
that, in this case, can be obtained by declaring a final variable
outside the onClick() method so that it can be accessed inside.
Second paramter must be the target classname dot class.
(TargetClass.class)
Modifying hte code..
final Context ctx = this; // i hope this code is
within the main activity
holder.btviewdetail.setOnClickListener(new
OnClickListener() {
public void onClick(View v){
Log.e("TEXTValue",
mList.get(position).get(mIndex[3]).toString());
//productlistitem a = new
productlistitem();
//
a.test(mList.get(position).get(mIndex[1]).toString());
Intent intent = new Intent();
intent.setClass(ctx,
productdetail.class); // productdetail doesnt seem to be the class
name. Rename this as the class name
startActivity(intent);
}
});
On May 6, 9:50 am, Siow <[email protected]> wrote:
> I have one custom Listview with a button, now i want to click the
> button and open another class. below is my code, but have error, any
> one can help one it??
>
> this one is a custom adapter.
>
> holder.btviewdetail.setOnClickListener(new OnClickListener() {
> public void onClick(View v){
> Log.e("TEXTValue",
> mList.get(position).get(mIndex[3]).toString());
> //productlistitem a = new productlistitem();
>
> //a.test(mList.get(position).get(mIndex[1]).toString());
>
> Intent intent = new Intent();
> intent.setClass(productlistitem.this,
> productdetail.class);
> startActivity(intent);
> }
>
> });
>
> error in the intent setclass.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en