Add Image on EditText in Android

Azhar
Updated on 03-Jul-2020 12:58:36

1K+ Views

This example demonstrates how add an image on EditText in Android .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/layout/activity_main.xml.     Step 3  − Add the following code to src/MainAvtivity.javapackage com.example.sample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    } }Step 4  − Add the following code to drawable/background.xml         ... Read More

Set Opacity for View in Android

Azhar
Updated on 03-Jul-2020 12:57:43

3K+ Views

This example demonstrates how to Set opacity for View in Android .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/layout/activity_main.xml.         Step 3  − Add the following code to src/MainActivity.javapackage com.example.sample; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.animation.ObjectAnimator; import android.app.Activity; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView txt;    Button btn;    ObjectAnimator objectanimator;    @Override    protected void onCreate(Bundle savedInstanceState) {       ... Read More

Convert Bitmap to Drawable in Android

Azhar
Updated on 03-Jul-2020 12:57:08

2K+ Views

This example demonstrates how do I convert Bitmap to drawable in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.        Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity {    ImageView imageView;    Button button;    Bitmap bitmap;    Drawable drawable;    @Override    protected void onCreate(Bundle savedInstanceState) {   ... Read More

Create a Table with Borders in Android

Azhar
Updated on 03-Jul-2020 12:56:33

3K+ Views

This example demonstrates how create a table with borders in Android .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/layout/activity_main.xml.                                                                                         ... Read More

Get Resource Name Using Resource ID in Android

Azhar
Updated on 03-Jul-2020 12:55:54

1K+ Views

This example demonstrates how do I get resource name using Resource id in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       textView = findViewById(R.id.textView);       int text ... Read More

Add Border to Top and Bottom of an Android View

Azhar
Updated on 03-Jul-2020 12:55:12

7K+ Views

This example demonstrates how to add a border to the top and bottom of an Android View .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/drawable/border_top_bottom.xml                                                                       Step 3  − Add the following code to res/layout/top_bottom_border_in_android_view.xml ... Read More

Disable Click of Home Button on Android Device

Azhar
Updated on 03-Jul-2020 12:54:26

3K+ Views

This example demonstrates how to disable the click of home button of Android device .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/layout/activity_main.xml.     Step 3  − Add the following code to src/MainActivity.javapackage com.medkart.sample; import androidx.appcompat.app.AppCompatActivity; import android.app.ActivityManager; import android.content.Context; import android.os.Bundle; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);    }    @Override    protected void onPause() { ... Read More

Crop Circular Area from Bitmap in Android

Azhar
Updated on 03-Jul-2020 12:53:52

209 Views

This example demonstrates how do I crop circular area from bitmap in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

Create a Splash Screen on Android App

Azhar
Updated on 03-Jul-2020 12:51:30

782 Views

This example demonstrates how to pass data between activities.Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Add the following code to res/layout/activity_main.xml     Step 3  − Add the following code to src/MainActivity.javapackage com.example.sample; import android.content.Intent; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import static java.lang.Thread.sleep; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       startActivity(new Intent(MainActivity.this, SecondActivity.class));       try {          sleep(3000);     ... Read More

Set an Icon for Your Android Application

Azhar
Updated on 03-Jul-2020 12:50:50

4K+ Views

This example demonstrates how set an icon for my Android application .Step 1  − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2  − Further follow the path to reach the desired folder to add icon (app → res → mipmap).Step 3 - Add you app icon. You can just simply copy and paste the image in mipmap folder.Step 4 - After placing the image in the mipmap folder. You need to rename the default icon name to your icon image name.Step 5  − Add the following ... Read More

Advertisements