Found 1966 Articles for Apps/Applications

How to disable the click of home button of Android device?

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

2K+ 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

How to add a border to the top and bottom of an Android View?

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

6K+ 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

How to get Resource name using Resource id in Android?

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

868 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

How can I create a table with borders in Android?

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

2K+ 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

How to 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

How to Set opacity for View in Android?

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

2K+ 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

How can I add an 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

How to create a Dialog Box without a title in Android?

Azhar
Updated on 03-Jul-2020 12:45:02

182 Views

This example demonstrates how to create a Dialog Box without a title 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.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class Dialog extends AppCompatActivity {    Button ... Read More

How to copy text programmatically (Ctrl+C) in my Android app?

Azhar
Updated on 03-Jul-2020 12:44:28

848 Views

This example demonstrates how do I copy text programmatically (Ctrl+C) in my android app.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.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    EditText editText;    TextView textView;    ClipboardManager clipboardManager;    @Override   ... Read More

How to overlay two images in Android to set an ImageView?

Azhar
Updated on 03-Jul-2020 12:47:07

2K+ Views

This example demonstrates how do I overlay two images In Android to set an ImageView.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 − Copy and paste two images which you want to overlay(Merge) in the res/drawable Then Create a drawable resource file (layer.xml) and add the following code,         Step 3 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; ... Read More

Advertisements