Create Horizontal ListView in Android

Azhar
Updated on 08-Jul-2020 05:38:50

1K+ Views

This example demonstrates how do I create Horizontal ListView 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.Kindly add the below-given dependence in the Gradle −implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0'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 androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import java.util.ArrayList; import java.util.Arrays; public class MainActivity extends AppCompatActivity {    RecyclerView recyclerView;    RecyclerView.LayoutManager layoutManager;    RecyclerView.Adapter adapter;    ArrayList numberName;    ArrayList numberImage;    @Override ... Read More

Make Android SlidingDrawer Slide Out from the Left

Azhar
Updated on 08-Jul-2020 05:21:41

388 Views

This example demonstrates how do I make an android slidingdrawer slide out from the left 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; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate(Bundle savedInstanceState) {       ... Read More

Create Focusable EditText Inside ListView on Android

Azhar
Updated on 08-Jul-2020 05:21:09

953 Views

This example demonstrates how do I create a focusable editText inside ListView 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 − Create a new layout resource file and add the following code−         Step 4 − Add the following code to src/MainActivity.javaimport androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; import android.app.LauncherActivity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.EditText; import ... Read More

Convert Drawable to Bitmap in Android

Azhar
Updated on 08-Jul-2020 05:20:37

6K+ Views

This example demonstrates how do I convert Drawable to a 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.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    ImageView imageView;    Button btnConvert;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

Get Zoom Functionality for Images on Android

Azhar
Updated on 08-Jul-2020 05:20:04

457 Views

This example demonstrates how do I get zoom functionality for images 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.import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.widget.ImageView; public class MainActivity extends AppCompatActivity {    private ScaleGestureDetector scaleGestureDetector;    private float scaleFactor = 1f;    private ImageView imageView;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);       setContentView(R.layout.activity_main);       imageView = findViewById(R.id.imageView);       ... Read More

Add Google Search Functionality in an Android App

Azhar
Updated on 08-Jul-2020 05:19:22

1K+ Views

This example demonstrates how do I add google search functionality in an 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.app.SearchManager; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    EditText editText;    Button btnSearch;    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);   ... Read More

HTML DOM Touchmove Event

AmitDiwan
Updated on 08-Jul-2020 05:18:48

412 Views

The HTML DOM touchmove event is triggered when touch is moved across the touch screen.NOTE − This event is only for touch devices.Following is the syntax −Trigger touchmove event in HTML −ontouchmove = "eventFunction()"Trigger touchmove event in JavaScript −eventObject.ontouchmove = eventFunctionNote − We ran Touch event examples on Online HTML Editors accessed on Mobile or systems with touch access. This is done so that we can perform touch operations like touch the screen for 2 seconds.Let us see an example of touchmove event property −Example Live Demo HTML DOM touchmove event    * {       padding: 2px; ... Read More

HTML DOM Touchstart Event

AmitDiwan
Updated on 08-Jul-2020 05:18:07

461 Views

The HTML DOM touchstart event is triggered when touch screen is touched.NOTE − This event is only for touch devices.Following is the syntax −Trigger touchstart event in HTML −ontouchstart = "eventFunction()"Trigger touchstart event in JavaScript −eventObject.ontouchstart = eventFunctionNote − We ran Touch event examples on Online HTML Editors accessed on Mobile or systems with touch access. This is done so that we can perform touch operations like touch the screen for 2 seconds.Let us see an example of touchstart event property −Example Live Demo HTML DOM touchstart event    form {       width:70%;       margin: 0 ... Read More

Pass Data Between Activities in Android Application

Azhar
Updated on 07-Jul-2020 14:42:22

196 Views

This example demonstrates how to pass data between Activities on 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  − Add the following code to res/layout/activity_main.xml.                                                                                                   ... Read More

Use Date Time Picker in Android

Azhar
Updated on 07-Jul-2020 13:56:58

5K+ Views

This example demonstrates how do I use date and time picker 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 android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.format.DateFormat; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; import android.widget.TimePicker; import java.util.Calendar; public class MainActivity extends AppCompatActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {    TextView textView;    Button button;    int day, month, ... Read More

Advertisements