Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project i used the button event,with intent activity.. But it is not forwarding from current class to feature class.Here i used the button to connect with bluetooth device.But the button is not working currectly..There is no response by clicking the button.

button event
Java
try
{  
    Button bt = (Button)findViewById(R.id.buttonconnect);
    bt.setOnClickListener(new View.OnClickListener() 
    {
        public void onClick(View v) {
            // Perform action on click 
            Intent serverIntent = new Intent(MainActivity.this,DeviceListActivity.class);
            startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
        }
    });
    }catch(Exception e){
        e.printStackTrace();
    }
Posted
Updated 26-Aug-14 23:00pm
v2
Comments
Sergey Alexandrovich Kryukov 27-Aug-14 11:20am    
"Not working" is not informative. Not enough information.
—SA
Sandeep Londhe 1-Sep-14 14:46pm    
use getApplicatonContext() instead of MainActivity.this
Edward Quixote 14-Sep-14 2:13am    
Have you implemented onActivityResult()?
Can you try first using startActivity() only?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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