About the MediaController

by rupesh sasne » Sat, 27 Mar 2010 07:10:47 GMT


Sponsored Links
 Hi,

is there any way to customise the behaviour of MediaController...?
the screen is disappearing after 3 sec... and i dont want that...

--



Other Threads

1. Android Custom Dialog Leak on Orientation Change

Hello Android Community,

I have a custom dialog box that asks for user input. Relevant code
below:

public class AddNumberDialog extends Dialog
{
    public interface ReadyListener
    {
        public void ready(String label, String number, int fwding);
    }

    private String name;
    private ReadyListener readyListener;
    EditText addNumber;
    EditText addLabel;
    CheckBox checkForwarding;

    public AddNumberDialog(Context context, String name, ReadyListener
readyListener)
    {
        super(context);
        this.name = name;
        this.readyListener = readyListener;
    }

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_number);
        setTitle("Add Number");
        Button addButton = (Button)
findViewById(R.id.addNumberButton);
        addButton.setOnClickListener(new OKListener());
        addLabel = (EditText)
findViewById(R.id.addLabelField);
        addNumber = (EditText) findViewById(R.id.addNumberField);
        checkForwarding = (CheckBox)findViewById(R.id.forwardCheck);
    }


    private class OKListener implements
android.view.View.OnClickListener
    {
        public void onClick(View v)
        {
                int forwarding = 0;
                if(checkForwarding.isChecked())
                        forwarding = 1;
 
readyListener.ready(String.valueOf(addLabel.getText()),String.valueOf(addNumber.getText()),
forwarding);
            AddNumberDialog.this.dismiss();
        }
    }
}

In the application, I have it so this dialog appears when the user
presses a button:

Button b = (Button)this.findViewById(R.id.add_button);
        b.setOnClickListener(
              new Button.OnClickListener()
              {
                 public void onClick(View v)
                 {
                    addButtonClicked(v);
                 }
              });

    private void addButtonClicked(View v)
    {
        AddNumberDialog myDialog = new AddNumberDialog(this, "",
                new OnReadyListener());
        myDialog.show();
    }

Everything works fine with the button and passing information back to
the app. The problem I'm having is that when the screen switches
orientation (landscape to portrait etc.) the dialog causes a runtime
exception and the box closes.
This is really bad because G1 users or users with a hard keyboard will
definitely be switching orientations while that dialog box is open
because they will be opening the keyboard to type in the dialog box.

The relevant LogCat info is listed below:

08-09 18:15:56.673: ERROR/WindowManager(1725): Activity
com.cox.callforward.CallForward has leaked window
com.android.internal.policy.impl.phonewindow$decorv...@43d08bd0 that
was originally added here
08-09 18:15:56.673: ERROR/WindowManager(1725):
android.view.WindowLeaked: Activity com.cox.callforward.CallForward
has leaked window com.android.internal.policy.impl.PhoneWindow
$decorv...@43d08bd0 that was originally added here
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewRoot.<init>(ViewRoot.java:227)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.Window$LocalWindowManager.addView(Window.java:424)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.app.Dialog.show(Dialog.java:239)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.cox.callforward.CallForward.addButtonClicked(CallForward.java:76)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.cox.callforward.CallForward.access$4(CallForward.java:72)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.cox.callforward.CallForward$1.onClick(CallForward.java:51)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.View.performClick(View.java:2364)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.View.onTouchEvent(View.java:4179)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.widget.TextView.onTouchEvent(TextView.java:6540)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.View.dispatchTouchEvent(View.java:3709)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
1107)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.app.Activity.dispatchTouchEvent(Activity.java:2061)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.os.Handler.dispatchMessage(Handler.java:99)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.os.Looper.loop(Looper.java:123)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
android.app.ActivityThread.main(ActivityThread.java:4363)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
java.lang.reflect.Method.invokeNative(Native Method)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
java.lang.reflect.Method.invoke(Method.java:521)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-09 18:15:56.673: ERROR/WindowManager(1725):     at
dalvik.system.NativeStart.main(Native Method)

-- 

2. How to update 3rd party Android application without user action ??

Hi all

I would like to know if it's possible to update a third party
application without user action.

By 3rd party, I mean an application not located on the Android Market
but rather on a specific website.

Thx

Joany

-- 

3. on sdcard, File.canRead() = true, File.canWrite() = false

4. Open source devs, read this... someone might try to make money with your project

5. Not able to set APN with 2G network, but works with 3G

6. loadDataWithBaseURL stopped working on Nexus 1 2.2

7. how do i change an image at runtime?