Using intent into non activity class
<p>After trying a lot i decided to ask question on stackoverflow, I create a class for using on button click and start an intent from this class.</p>

<pre><code>import android.app.Activity;
import android.content.Intent;
import android.view.View;

public class OnClickListener implements android.view.View.OnClickListener{

    Activity current;
    Object goTo;

    public OnClickListener(Activity arg0, Activity arg1){
        this.current = arg0;
        this.goTo = arg1;
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(current, goTo.getClass());
        current.startActivity(intent);
    }

}
</code></pre>

<p>and passing parameter like this:</p>

<pre><code>Button button = (Button)findViewById(R.id.class2_btn);
        Class2 class2 = new Class2();
        OnClickListener listener = new OnClickListener(class1.this, class2);
        button.setOnClickListener(listener);
</code></pre>

<p>why this is not working? after clicking button why this is not going to next class?
Please help me.</p>
