i have one main Activity class which contains huge amount of code/data. So i want to make it short and readable so i want to create one .java file which handle the some func
Yes you can do this by implementing OnClickListener in your other java class and call this in you activity class for this do like this
Button b=(Button)findviewById(R.id.b1);
b.setOnClickListener(new NonActivityClass(this));
We are passing activity context to NonActivityClass this will make you access your UI component in NonActivityClass but keep in mind this may lead to memory leak;
And implement OnClickListener like :
public class NonActivityClass implements OnClickListener
{
void onClick(View oView)
{
// Do your stuff here
}
}