Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6661579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:17:50+00:00 2026-05-26T02:17:50+00:00

Could anybody help me how can I set this echo command which you can

  • 0

Could anybody help me how can I set this echo command which you can see below on boot adoption (because when I only execute it with button so after restart there are default values again)? I know how make it with BroadcastReceiver, but I have more buttons and each button contains one echo command and I need only last clicked button with echo command set on boot adoption.

Here is example:

public class MyActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_layout);

        Button b=(Button)findViewById(R.id.btn_button);
        b.setOnClickListener(new OnClickListener(){
            public void onClick(View paramView){

            Process b;
        try {
            b = Runtime.getRuntime().exec("su"); 

            DataOutputStream os = new DataOutputStream(b.getOutputStream()); 
            os.writeBytes("echo '1,1,1,1,1,1' > /sys/module/lowmemorykiller/parameters/minfree\n");
            os.writeBytes("exit\n"); 
            os.flush();
            try {
                b.waitFor();
                if (b.exitValue() != 255) {
                    // TODO Code to run on success
                    toastMessage("root");
                    }
                else {
                    // TODO Code to run on unsuccessful             
                   toastMessage("not root");
                   }
            } catch (InterruptedException e) {
                // TODO Code to run in interrupted exception    
                toastMessage("not root");
                }
        } catch (IOException e) {
            // TODO Code to run in input/output exception
            toastMessage("not root");
            }
            }
        });
    }

THANK YOU.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:17:51+00:00Added an answer on May 26, 2026 at 2:17 am

    The question is slightly unclear but from what I can comprehend broadcast is the designed method. This would require that you launch your activity from the service receiving the BOOT_COMPLETE broadcast.

    You can launch an activity from your service like this:

    Intent intent = new Intent(MyService.this,MyActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    

    You could either bind the activity to your service or move your “echo” code into a static helper to keep it tidy.

    Alternatively if you wish to run your activity as a launcher you can use

    <category android:name="android.intent.category.LAUNCHER" />
    

    but that may not be your inteded solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small question, if anybody could help me. Why I can't see
Can anybody please explain how this could possibly happen? I am completely aware of
Could anybody help with this? I am trying to integrate a coupon function into
Could please anybody help me to sort it out? It can be done like
I would be grateful if anybody could help me out with this. I have
Could anybody help me to understand this issue? The problem is: I have a
Could anybody help me, please? I have this code: Process a; try { a
Can anybody help or point me in the right direction for a tutorial/example for
I'm wondering if anybody can help? I have a large number of excel files.
Could anybody help me with some Jquery. I have a <div> with a bunch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.