How to navigate to android USB Mass Storage Activity?
Asked Answered
A

2

8

I would like to get USB Mass Storage activity to turn on or off the usb mode when device is connected to pc.I have implemented an application as follows.

public class USB_ConnectActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final String state = Environment.getExternalStorageState();
    ((Button)findViewById(R.id.onButton)).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (!(Environment.MEDIA_SHARED.equals(state))) {

                //How to navigate android USB Mass Storage page

            }
        }
    });


    ((Button)findViewById(R.id.offButton)).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if ((Environment.MEDIA_SHARED.equals(state))) {

                //How to navigate android USB Mass Storage page

            }

        }
    });

        }
   }

from the above code I have used two buttons for turn off and on usb mass storage.But I don't have more information about it to navigate android in built USB Mass Storage page. Please any body help me.

Apportion answered 5/6, 2012 at 7:25 Comment(1)
Its not possible.Android SDK dose not support itDamson
I
1

If you only want to launch the USB mass storage Activity, then your question is an exact duplicate of: Android Intent to open "Mass Storage Activity" and should be closed.

If you actually want to change the status of the USB mode, which is what it looks like, then this isn't a duplicate (as far as I can tell), but the answer is still: you can't do it.

Maybe there's a better way, but when I want to know what Intents are available for launching system Activities, I look at the Android SDK documentation for Intent and search for "activity action". That shows you many system Activities you can launch, such as the "battery use" Activity and the uninstallation Activity. There's nothing there showing the USB mode Activity as a public Intent. Excusing the pun, this was probably intentional.

And there's certainly no documentation I can find about any way to programmatically turn USB mode on or off, and this is also presumably intentional.

Imaret answered 14/6, 2012 at 5:49 Comment(0)
S
1

This is not possible from the Android SDK.

Stanwin answered 9/6, 2012 at 14:55 Comment(1)
Explaining why would help, perhaps you could expand your answer?Lassie
I
1

If you only want to launch the USB mass storage Activity, then your question is an exact duplicate of: Android Intent to open "Mass Storage Activity" and should be closed.

If you actually want to change the status of the USB mode, which is what it looks like, then this isn't a duplicate (as far as I can tell), but the answer is still: you can't do it.

Maybe there's a better way, but when I want to know what Intents are available for launching system Activities, I look at the Android SDK documentation for Intent and search for "activity action". That shows you many system Activities you can launch, such as the "battery use" Activity and the uninstallation Activity. There's nothing there showing the USB mode Activity as a public Intent. Excusing the pun, this was probably intentional.

And there's certainly no documentation I can find about any way to programmatically turn USB mode on or off, and this is also presumably intentional.

Imaret answered 14/6, 2012 at 5:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.