Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Idk what to do so basically i was creating a button which opens new activity on long press could u fix this?
So This Is The Code


What I have tried:

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    button = (Button) findViewById(R.id.button);

    defineView();
    handleIntent();
    defineActionBar();
    checkPermission();

    button.setOnLongClickListener(new View.OnCLongClickListener() {
        @Override
        public void onLongClick(View v) {
            openWebsite();
        }
    });
}



public void openWebsite() {
    Intent intent = new Intent(this, Website.class);
    startActivity(intent);
}
Posted
Comments
0x01AA 28-Jul-22 18:03pm    
Most members here are not interesting in 'idk' and 'u' and whatever. As long as you can't express you in a suitable language most members here will skip your 'Q' ;p
Afzaal Ahmad Zeeshan 28-Jul-22 18:48pm    
And the problem is?
CoderzF1 16-Sep-22 0:53am    
is Website.class even an Activity?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900