How to Change phone Profile

//Construct object of Audio Manager
AudioManager audMangr;
audMangr= (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);

//For Normal mode
audMangr.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

//For Silent mode
audMangr.setRingerMode(AudioManager.RINGER_MODE_SILENT);

//For Vibrate mode
audMangr.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);

source code
Java class

package com.silent;

import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class silentView extends Activity implements OnClickListener {
/** Called when the activity is first created. */

Button btns;
Button btng;

AudioManager audMangr;
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btns=(Button)findViewById(R.id.button1);
btng=(Button)findViewById(R.id.button2);

btns.setOnClickListener(this);
btng.setOnClickListener(this);

audMangr= (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);

}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
tv=(TextView)findViewById(R.id.textView1);
if(arg0==btns)
{
tv.setText(“Silent Profile Activated”);
//For Silent mode
audMangr.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}
if(arg0==btng)
{
tv.setText(“General Profile Activated”);
//For Normal mode
audMangr.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
}

}

}

main.xml




Output Application
Press on Silent Button to change Android phone mode Silent
and for General Press General Button

Related Posts

Earn Cash on Fiverr: Unlock Your Earning Potential in the Gig Economy

  Have you ever dreamed of turning your skills into cold, hard cash? Well, buckle up, because we’re about to embark on a journey through the exciting…

Become a Freelancer on Guru: How to Land High-Paying Gigs

  Are you ready to take control of your career and dive into the world of freelancing? Look no further than Guru, a platform brimming with opportunities…

how to earn 5 dollar per day from doing micro job

 There are many website which offer micro job . and you can earn 2 or 3 dollar per day from these website when you work few hours…

How to Create blogger website or Blog in Mobile : Complete Tutorial Step by Step

 Blogger blog or website can create easily without any special skills required. Second it’s no need domain and web hosting cost. Therefore creating and develope blogger website…

LinkedIn How to complete 500 connection in one week: Earning Online Unique Method

How You will Complete 500 connection within week. To learn the trick Please watch the video tutorial, then you will easily complete 500 connection within week  1….

How to earn money from used mobile buy sell bussiness

Almost every person of the word are using mobile. many people use 2 or 3 phone at same time. and mostly people change phone after any phone…

This Post Has One Comment

  1. really helpful post, I like your blog. your earning ideas are so simple and really work from . Now I am earning from Linkedin , sproutgigs and OTP services. thanks for your helpful blog.

Leave a Reply

Your email address will not be published. Required fields are marked *