Execute setprop command from application

by Giorgio M. » Wed, 04 Mar 2009 02:01:04 GMT

Sponsored Links
 I have to execute the shell command

setprop net.dns1 xxx.xxx.xxx.xxx

from an android activity but i can't find a working way to do it.

How can i execute this command from the application?


Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com


Other Threads

1. Intent.putExtra (String name, String[] value) caching old value

Try using setData() to store your message instead of extras: that
forces the Intent to be seen as a new one. Or you can keep using
extras and
create some other unique token every time for setData().


p.s. also see the flags you can use at the end of the getService call
the PendingIntent docs). There's something like


2. Can't i call a service function in activity's onStart/onCreate?

My activity bind a service.  I want to call the service's function in
actitity's onStart/onCreate function, but it doesn't work.
The service started suncess but the connection is null.

When I just call the service's function in other function (onClick for
example),  it works well.

thanks for help.

here is my code:

public class AidlTest extends Activity
    private static final String TAG = "AidlTest";
    IAidlService mService;

    private OnClickListener mCorkyListener = new OnClickListener() {
        public void onClick(View v) {

    private ServiceConnection mConnection = new ServiceConnection() {

        public void onServiceConnected(ComponentName className,  IBinder
service) {
            mService = IAidlService.Stub.asInterface(service);
        public void onServiceDisconnected(ComponentName className) {

            mService = null;

    public void onCreate(Bundle savedInstanceState)
        TextView v = new TextView(this);
        Log.v(TAG, IAidlService.class.getName().toString());
        Intent intent = new Intent(IAidlService.class.getName());
        bindService(intent, mConnection, Context.BIND_AUTO_CREATE);

    public void onStart(){
        Log.d(TAG, "onStart");

    public void test(){
        if (mService == null){
            Log.d(TAG, "mService is NULL");
        try {
        }catch (RemoteException e){
            Log.d(TAG, e.toString());



3. Custom View using XML layout & EditTexts: SavedState conflict

4. Can i fetch the latest image from gallery taken from camera ?

5. ListView Urgent Help Req :)

6. Help with UI XML

7. trouble with programmatically adding mock location data