UILabel with text of two different colors

Problem: I want to display a string like this in a UILabel: Where the number 5 is red in color and the rest of the string Solution: NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText]; [text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(10, 1)]; [label setAttributedText: text]; OR NSMutableAttributedString …

Turn on speakerphone whenever an outgoing call is made

You can set it through programmatically as below : AudioManager audioManager = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE); audioManager.setMode(AudioManager.MODE_IN_CALL); audioManager.setSpeakerphoneOn(true); But, keep in mind that don’t forgot to set speaker off when stop the call: audioManager.setSpeakerphoneOn(false); And, Set permission in manifest: android.permission.RECORD_AUDIO android.permission.MODIFY_AUDIO_SETTINGS This code is working fine for me.hope …