Found 1966 Articles for Apps/Applications

How to create a custom alert dialogs in an android app?

Azhar
Updated on 21-Aug-2019 08:32:31

151 Views

This example demonstrates how do I make a specific text on TextView bold 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 layout resourse file and add the following code in customdialog.xml             Step 3 − Add the following code to src/MainActivity.javaimport android.app.Dialog; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity ... Read More

How to change app language when user selects language in Android?

Azhar
Updated on 21-Aug-2019 08:30:37

976 Views

This example demonstrates how do I change app language when user selects language.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.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; import java.util.ArrayList; import java.util.List; import java.util.Locale; public class MainActivity extends AppCompatActivity {    Spinner spinner;    Locale locale;    String ... Read More

How to use ButterKnife In Android?

Azhar
Updated on 21-Aug-2019 08:27:41

836 Views

This example demonstrates how do I ButterKnife 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 – Open build.gradle(Module App) and add the following dependencyimplementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'Step 4 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends AppCompatActivity {    @BindView(R.id.textView)    TextView textView;    @BindView(R.id.textView2)   ... Read More

How to convert java bitmap to byte array In android?

Azhar
Updated on 21-Aug-2019 08:24:02

4K+ Views

This example demonstrates how do I convert java bitmap to byte array 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.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; public class MainActivity extends AppCompatActivity {    Button button;    ImageView ivSource, ivCompressed;    @Override    protected ... Read More

How to use drag and drop in Android?

Azhar
Updated on 21-Aug-2019 08:24:11

446 Views

This example demonstrates how do I use drag and drop 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.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; public class MainActivity extends AppCompatActivity implements View.OnTouchListener, View.OnDragListener {    @Override    protected void onCreate(Bundle savedInstanceState) {       super.onCreate(savedInstanceState);     ... Read More

How to use checkbox in Android?

Azhar
Updated on 21-Aug-2019 08:28:54

254 Views

This example demonstrates how do I make a specific text on TextView bold 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.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    CheckBox pizza, coffee, burger;    Button buttonOrder;    @Override    protected void onCreate(Bundle savedInstanceState) {   ... Read More

How to create a gridView layout in an Android app?

Azhar
Updated on 02-Jul-2020 07:19:21

496 Views

This example demonstrates how do I gridView layout in an 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 – Open build.gradle(Module: app) and add the following dependency −implementation 'com.android.support:gridlayout-v7:28.0.0'Step 4 − Add the following code to src/MainActivity.javaimport android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    GridView gridView;    String[] numberInWords = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", ... Read More

How to display a listView in an android alert dialog?

Azhar
Updated on 02-Jul-2020 07:19:55

1K+ Views

This example demonstrates how do I display a listView in an android aler dialog.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.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends AppCompatActivity {    String[] names = {"India", "Brazil", "Argentina",       "Portugal", "France", "England", "Italy"};    ArrayAdapter adapter;    ListView listView;    @Override    protected ... Read More

How to get the Value of a edittext field in Andriod?

Azhar
Updated on 02-Jul-2020 07:18:42

249 Views

This example demonstrates how do I get the value of a editText filed 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.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends AppCompatActivity {    Button button;    EditText editText;    String string;    TextView textView;    @Override    protected void onCreate(Bundle savedInstanceState) ... Read More

How to parse JSONArray in Android app?

Azhar
Updated on 02-Jul-2020 07:18:02

133 Views

This example demonstrates how do I parse JSONArray in 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 android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; 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);     ... Read More

Advertisements