Help making a button open another app with Java/Android

Posted by user569503 on Stack Overflow See other posts from Stack Overflow or by user569503
Published on 2011-01-10T07:45:34Z Indexed on 2011/01/10 7:53 UTC
Read the original article Hit count: 122

Filed under:
|

I am trying to learn to make a simple app that opens a couple of other apps to eliminate the need for another apps. I just can't figure it out.

From reading here and other places it seems this should work.

Button batteryhistory = (Button)findViewById(R.string.BatteryHistoryButtonDialog);

    batteryhistory.setOnClickListener(new View.OnClickListener() {

      @Override
      public void onClick(View view) {
      Intent i = new Intent(); 
       ComponentName n = new 
       ComponentName("com.android.settings", 
       "com.android.settings.BatteryHistory"); 
       i.setComponent(n); 
       startActivity(i);

Thanks so much for the help :D

© Stack Overflow or respective owner

Related posts about java

Related posts about android