For Better Search Results Only Write Subject OR Topic Name Like ( Math , Physics , Database , Algorithm ).
Description:
//don't change package name in your source. This is Example Taken from uniwaly.com
package com.uniwaly.rgbslider;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
public class MainActivity extends AppCompatActivity {
private SeekBar redSlider, greenSlider, blueSlider;
private TextView redValue, greenValue, blueValue, rgbDisplay;
private TextView colorBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
redSlider = findViewById(R.id.redSlider);
greenSlider = findViewById(R.id.greenSlider);
blueSlider = findViewById(R.id.blueSlider);
redValue = findViewById(R.id.redValue);
greenValue = findViewById(R.id.greenValue);
blueValue = findViewById(R.id.blueValue);
rgbDisplay = findViewById(R.id.rgbDisplay);
colorBox = findViewById(R.id.colorBox);
// Update color and values on slider change , uniwaly.com
SeekBar.OnSeekBarChangeListener listener = new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
updateColor();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
};
redSlider.setOnSeekBarChangeListener(listener);
greenSlider.setOnSeekBarChangeListener(listener);
blueSlider.setOnSeekBarChangeListener(listener);
}
private void updateColor() {
int red = redSlider.getProgress();
int green = greenSlider.getProgress();
int blue = blueSlider.getProgress();
redValue.setText(String.valueOf(red));
greenValue.setText(String.valueOf(green));
blueValue.setText(String.valueOf(blue));
int color = Color.rgb(red, green, blue);
colorBox.setBackgroundColor(color);
String rgbText = "RGB(" + red + ", " + green + ", " + blue + ")";
rgbDisplay.setText(rgbText);
}
}
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="#FFFFFF">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Red"
android:textSize="18sp"
android:layout_marginBottom="8dp"/>
android:id="@+id/redSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"/>
android:id="@+id/redValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:layout_marginBottom="16dp"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Green"
android:textSize="18sp"
android:layout_marginBottom="8dp"/>
android:id="@+id/greenSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"/>
android:id="@+id/greenValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:layout_marginBottom="16dp"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Blue"
android:textSize="18sp"
android:layout_marginBottom="8dp"/>
android:id="@+id/blueSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"/>
android:id="@+id/blueValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:layout_marginBottom="16dp"/>
android:id="@+id/rgbDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RGB(0, 0, 0)"
android:textSize="18sp"
android:layout_marginBottom="16dp"/>
android:id="@+id/colorBox"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#FFFFFF"/>
Please Login / Signup to Continue Download Study Material
Uniwaly does not host or upload any files including books, notes, past papers, or other educational materials. All content is provided through publicly available links from third-party websites such as Google Drive, Dropbox, and other file-sharing platforms. We respect copyright laws and recommend users to only download content that is freely available or shared with permission. If you believe any file violates copyright, please contact us immediately for review.
Descartes: An Intellectual Biography
Lecture 12 - Machining Processes - Manufacturing Processes
Chemistry Chapter 1 Part 1 ECAT Entry Test Preparation
Hacking For Dummies, 3rd Edition by Beaver, Kevin
Digital Logic and Computer Design by M. Morris Mano 2nd Edition
Lecture 6 - Design Issues - Distributed Database Design
Chemistry Chapter 1 Part 3 ECAT Entry Test Preparation
Man Raqsam Tan Raqsam Novel PDF By Nisha Umar
Organic Gardening for Dummies
Arise of Political Consciousness among Muslims
Atomic Physics
17F2025
4A2025
chapter 42 atomic physics
9A2025
Basic Engineering Circuit Analysis Chapter 5
chapter 41 quantum mechanics
119G2024
Understanding Third World Politics 2010
Applied Probability
Physics of the Impossible
Chapter 2 : Electronic Devices & Circuits By Robert L. Boylestad Louis Nashelsky
Martin's physical pharmacy and pharmaceutical sciences: physical chemical and biopharmaceutical
Financial Accounting Arif Sohail Afzal B.Com Part 1 3rd Edition
Thermodynamics : An Engineering Approach By Cengel , Yunus
Assembly Language - Registers and Its Types - Notes
124G2024
Lab Manuals - Experiment - Transistor as amplifier
Allah Se Khalis Mohabbat by Shabbir Qamar Bukhari
Write a Program that inputs a number in main function and passes the number to a function. The function displays factorial of that number.
14J2024
Learn Java for Web Development
Lecture 4 - Which Technologies Are Used? - Data Mining
Lecture 4 - Adhesive bonding , surface treatment and paints - Manufacturing Processes
55H2024
A Handbook of Native American Herbs
The Whole-Brain Child: 12 Revolutionary Strategies to Nurture Your Child's Developing Mind
Physics for Scientists and Engineers with Modern Physics - Table Content - Page 1- 36
Itikaf Aur Khawteen by Umm e Abd Muneeb
56J2024