lundi 27 janvier 2014

(Q)Dismiss RecentsDialog/Add Back button function in OnClick method. topic




Hello guys/girls.

i have been trying for a couple days to do something


as u can see i have three buttons in th bottom.

when i press on them it opens an application but behind the recents menu.
i would like to close the recents menu However i have tried to figure it out bit till now no solution found :/

I thought of either call/launch the close-system_dialog intent/broadcast i found in androids recentsapplicationdialog source but i couldnt find proper way or method to add.

then i wanted to try and add a Back button keycode/event but didnt really knew how to implement it.

Here is my code :


 





Code:


package com.example.recentsmenu;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class SearchButton extends Button{

        public SearchButton(final Context context, AttributeSet attrs) {
                super(context, attrs);
               
                this.setOnClickListener(new Button.OnClickListener() { 
            public void onClick(View v)
                    {
                                    try{                                           
                                            v.getContext().startActivity((new Intent("android.search.action.GLOBAL_SEARCH")).setFlags(0x10000000 | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP));
                                    }
                                    catch(Exception ex){ 
                                    Toast.makeText(context, "Not Installed/Working.",
                                            Toast.LENGTH_LONG).show();                                                     
                                    }       
                    }
              });
        }

}






if someone could help please do :)
thank you
greetings spacecaker.





Aucun commentaire:

Enregistrer un commentaire