getting proble at setclass

Put your problem here if it does not fit any of the other categories.

getting proble at setclass

Postby srinivas.b » Thu Jan 20, 2011 1:36 pm

private Button navbutton;
this.navbutton = (Button)this.findViewById(;
this.navbutton.setOnClickListener(new OnClickListener(){

public void onClick(View v) {

Intent intent;
intent = new Intent().setClass(this,loginnav.class);

Junior Developer
Junior Developer
Posts: 15
Joined: Thu Jan 13, 2011 12:14 pm


Re: getting proble at setclass

Postby vengeance_mj » Thu Jan 20, 2011 9:30 pm

You need to pass the Context of the parent class, since the context is unapplicable within an annonymous inner class. Let us assume your parent class name ( the one which extends Activity) has name Parent, then write ur Intent as

intent = new Intent().setClass(Parent.this,loginnav.class);
Senior Developer
Senior Developer
Posts: 174
Joined: Thu Oct 29, 2009 2:32 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests