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(R.id.Button01);
this.navbutton.setOnClickListener(new OnClickListener(){

public void onClick(View v) {

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

startActivity(intent);
finish();
}
});
srinivas.b
Junior Developer
Junior Developer
 
Posts: 15
Joined: Thu Jan 13, 2011 12:14 pm

Top

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);
vengeance_mj
Senior Developer
Senior Developer
 
Posts: 174
Joined: Thu Oct 29, 2009 2:32 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 27 guests