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

Status
Not open for further replies.
Search This thread

SpaceCaker

Senior Member
Mar 26, 2011
13,545
10,904
netherlands
www.youtube.com
i am using eclipse and on ICS+ i know how to do it as on that i simply can use Collapsecode for collapsing statusbar.wich i also tried here but didnt worked.

on GB its different a lot more different


and i compile a simply app with the custlm buttons in java

build package
export apk
and add the smali files properly to my frameworks and implement inside the layout i wanted.

this is what j also did with systemui and some other apps and such.

Sent from my S500 using xda app-developers app
 

arpitkh96

Senior Member
Feb 17, 2012
1,156
645
27
panipat
i am using eclipse and on ICS+ i know how to do it as on that i simply can use Collapsecode for collapsing statusbar.wich i also tried here but didnt worked.

on GB its different a lot more different


and i compile a simply app with the custlm buttons in java

build package
export apk
and add the smali files properly to my frameworks and implement inside the layout i wanted.

this is what j also did with systemui and some other apps and such.

Sent from my S500 using xda app-developers app

As you know that there are system and user api's in android.user apps do not have permissions to handle recent apps.so you will have to work from source only

Sent from my GT-S5570 using XDA Premium 4 mobile app
 
  • Like
Reactions: SpaceCaker

SpaceCaker

Senior Member
Mar 26, 2011
13,545
10,904
netherlands
www.youtube.com
android.user
is implemented if correct in 4.2+ only


and even when i tried to build from source it did the same thing

and all my smali go straight inside the framework

i only need to figure out how i can launch Back button keycode to simulate back key press onclick

or launch the close system dialogs intwnt or such.

i know that its possible because i saw it inside tasker but for more i havent found any documentation

Sent from my S500 using xda app-developers app
 

arpitkh96

Senior Member
Feb 17, 2012
1,156
645
27
panipat
android.user
is implemented if correct in 4.2+ only


and even when i tried to build from source it did the same thing

and all my smali go straight inside the framework

i only need to figure out how i can launch Back button keycode to simulate back key press onclick

or launch the close system dialogs intwnt or such.

i know that its possible because i saw it inside tasker but for more i havent found any documentation

Sent from my S500 using xda app-developers app

There are some apps which do this using root or android debugging.like button savior or pie control.some devs who made this are also on xda you can ask them
how they implemented

Sent from my GT-S5570 using XDA Premium 4 mobile app
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Never used ImageButton xD

    i think its same as Button or ImageView

    Sent from my S500 using xda app-developers app

    1. What you are trying to do can be done by using an ImageView/ImageButton. You don't need to extend extra classes.
    2. That's an activity. Just call finish() before passing your search intent.
    3. Profit.
    1
    Hello guys/girls.

    i have been trying for a couple days to do something
    11.jpg


    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.
    1
    It is working sir ? But the only problem you are encountering sir is the it is at the back. As I can see, you need to make a new method pertaining that it will trigger to close the layout of recent dialog.

    make a method that will close the layout, dont know how exactly


    Code:
    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(); 	         	    			
            	    		}	
                        }
                   });
    	}
    	collapselayout(); //i think this is
    }
    1
    At the end of your onClick method in Java add
    Code:
     finish();

    This is what I did in the redundant activity that opened in the Jelly Bean Easter Egg I ported :p

    But it should be an activity where your method is, if its a Service, you must use

    Code:
     Activity act = new Activity();
    act.finish();
    Where, Activity is the Activity name (Activity.class)

    If it's a Fragment (Though I know it isn't)

    Code:
    getActivity().finish();
    1
    For GB, the recents is a dialog. Close the dialog using the following intent. This should work if its a dialog.

    Code:
    Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);