Android

In this webpage you can have information about the development of various Android Applications.

Build a chat message App in Android Studio using Firebase database

Design a location tracking App using GPS in Android Studio

Design custom browser Android App to access application like YouTube, Radio, News Channel

Create a simple Alarm Clock App in Android Studio

How to use Facebook Conceal Method to Encrypt your data like password before storing in SQLite Database in Android? – Complete source code

How to Create a Custom Calendar App to store reminders and events using SQLite Database in Android Studio?

How to send SMS automatically from your phone by programming in Android Studio java code?

How to track your location using GPS and send it over sms in your Andoid App? – Complete Source Code

How to create PDF file in your Android App? Complete source code using Android Studio

Create Android chat message App with End to End AES(Advanced Encryption Standard) method in Firebase

How to create walking step counter App using Accelerometer sensor and Shared Preference in Android?

How to design a simple Audio Recorder App in Android Studio?

How to create foreground services and notification in your Android App?

How to take screenshot from your Android App and open the image file programmatically?

How to fetch data from SQLite database and put that in a PDF File in your Android App? – source code

How to open and send email using the native client directly from your Android App? – Source Code

How to switch Wifi On and Off automatically or remotely in your Android App? – Complete Source Code

How to access file system using explorer or browser in your Android App? – complete source code.

How to convert Latitude and Longitude location to an actual address and show on map in Android App?

How to adjust the volume of your Android Phone programmatically from your App? – Source code

How to control screen brightness level through your custom Android App? – Complete source code

How to access the battery level and ring an alarm automatically in your Android App? – complete code

Create a stop watch or counter using broadcast and notification in foreground service in Android

How to convert JPG image file into PDF file in your Android App? – complete source code.

How to create custom camera App to take pictures in Android phone?

How to control audio or ringtone settings of your Android phone remotely without Internet using SMS?

How to create Service class to run a custom alarm clock in your Android? – Complete source code

How to create your custom video player App in Android?

How to create your PDF reader Android App? – complete source code

How to convert Text to Speech in your Android App? – Complete source code

How to develop a Quick Sort recursive Algorithm App in Android Studio?

How to create a simple Android Camera App or Mirror App to preview the images using Android Studio?

How to give voice command to your phone from your custom Android App to perform certain operations?

How to generate pure random number in your Android App using sensor data of Temperature, Gravity, Gyroscope, pressure, proximity, etc.?

How to Open/Start another App such as gmail, whatsapp, SMS, Facebook from your custom Android App?

How to call or dial a phone number from your own custom Android App? – Complete Source code

How to implement search view functionality in the App using Firebase Database in Android Studio?

How to develop an Android App for your retail business (B2C) using Firebase Database?-source code

How to access SMS or read last SMS in your phone using your App – Android Studio Java code?

How to sort a string array using Insertion method in your Android App?

Android Chat Message App – Part 2 – How to create custom unique ID and parse it for firebase db ?

Bubble Sort Algorithm solved in Android App using recursion.

Create a simple business App using SQL Lite Database in Android Studio – for beginners.

Create location tracking Android App by exchanging location information over Firebase database.

How to create or generate QR (Quick Response) Code in your Android App? – complete source code

How to compute GCD (Greatest Common Divisor) or HCF Highest Common Factor in your Android App? Android Studio complete source code

How to generate bar code for any text in your Android App? – Android Studio Source code

How to switch Torch or Flash Light on and off from your Android App? – complete source code

How to create your own QR Code and Barcode scanner reader Android App? – complete source code

How to implement fingerprint biometric authentication in your Android App? – complete source code

How to create your own Compass Android App using Magnetic Field and Accelerometer Sensors in Android Studio? – Complete Source code

How to detect the Mobile Network Type (2G, 3G, 4G, 5G) from your Android App? – Android Studio Complete source code

How to read or access the contacts saved in the phone from your Android App?


17 comments

  1. Dear Sir,

    How can I design a combobox with list of items in the store in the program of business app? On selection from the dropdown list, its detail (balance quantity, price etc.) should appear in the textbox. Is it possible?

    Thanks a lot Sir.

    Fysal Usman

    1. I think you can design a listview as shown in the below video to display the data from the db:
      https://programmerworld.co/android/how-to-develop-an-android-app-for-your-retail-business-b2c-using-firebase-database-source-code/

      To choose what to display (like balance quantity, price, etc.), you can implement a drop-down or radio buttons or check-box option. Based on the selection, the output of the listview can be shown.

      An example from the above link’s code is:

      myRef.addValueEventListener(new ValueEventListener() {
      @Override
      public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
      ValueDatabase = dataSnapshot.getValue().toString();
      refinedData = ValueDatabase.substring(1,ValueDatabase.length()-1);
      String List[] = refinedData.split(“,”);
      if(){
      listView.setAdapter(new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, List));
      }
      }

      Hope above helps.

      Good Luck
      Programmer World

  2. Thank you very much Sir. As always you are very quick to respond and help, which I value above all. I will, God willing, try as per your guidelines. If I stumble at any obstacle, let me contact you for your usual help and support.

    Thanking you once again, I remain,

    Very truly yours,

    Fysal Usman

  3. Sir, One more thing. Your program uses firebase database. I am using MS Sql database. How can I change the codes changing from firebase database to MS Sql?

    Fysal Usman

    1. For changing the code from Firebase to SQL, instead of ‘dataSnapshot’ in the below (Firebase code):

      public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
      ValueDatabase = dataSnapshot.getValue().toString();
      refinedData = ValueDatabase.substring(1,ValueDatabase.length()-1);
      String List[] = refinedData.split(“,”);
      listView.setAdapter(new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, List));

      }

      Use ‘Cursor’ as shown in the below SQLite database code:

      Cursor myCursor = myDB.rawQuery(query, null);
      if (myCursor.moveToFirst()){
      myCursor.moveToFirst();
      textViewDisplay.setText(myCursor.getString(0) + ” — ” + myCursor.getString(1));
      }

      You can refer to the below page in which it uses Sqlite database. Sqlite and MS Sql db concept will be similar.
      https://programmerworld.co/android/create-a-simple-business-app-using-sql-lite-database-in-android-studio-for-beginners/

      Good Luck
      Programmer World

    1. Dear Sir,

      After watching your both videos, which have pushed the frontier of my knowledge (at first it was zero) very far, I feel I need some more to meet my requirement. What I need is, instead of typing what I want to search, I should be able to pick from a dropdown list. This is because, the list of commodities are too many, and their names are not familiar, therefore, typing may result it spell mistake aborting my search. Can spinner (the android term for combobox) meet my requirement? If so, can you help me to code for that? I would ever remain grateful to you for that.

      Thanks a lot Sir.

      Fysal Usman

      1. Yes, spinner will do the job.

        Below is a sample example of spinner I implemented:

        XML file (for layout design):

        And then in the Java code:

        private Spinner spinner;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        spinner = findViewById(R.id.spinner);
        spinner.setOnItemSelectedListener(this);

        }

        @Override
        public void onItemSelected(AdapterView parent, View view, int position, long id) {
        switch (position) {
        case 0:
        // TODO … action
        break;
        case 1:
        // TODO … action
        break;
        case 2:
        // TODO … action
        break;

        }
        }

        @Override
        public void onNothingSelected(AdapterView parent) {

        }

        In the onItemSelected method, either you can use position or id in the switch case.

        The layout should appear with below options in spinner:
        Home
        Work
        Other
        Custom

        Cheers
        Programmer World

  4. Dear Sir,

    I created spinner with your help, but when I ran it, message in the emulator saying the app has stopped. I am copy pasting the codes hereunder. If you can advise me where I have erred, that would be the greatest help I get from anybody.

    MainActivity.java

    package com.example.mobledger;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;

    import android.annotation.SuppressLint;
    import android.os.Bundle;
    import android.os.StrictMode;
    import androidx.appcompat.app.AppCompatActivity;
    import android.util.Log;
    import android.view.View;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemSelectedListener;
    import android.widget.ArrayAdapter;
    import android.widget.Spinner;
    import android.widget.Toast;

    import com.example.mobledger.R;

    public class MainActivity extends AppCompatActivity {
    Spinner spinneritems;

    String ip, db, un, passwords;
    Connection connect;
    PreparedStatement stmt;
    ResultSet rs;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ip = “192.168.18.18”;
    un = “sa”;
    passwords = “12345678”;
    db = “SelectionShoes”;
    //server = “DESKTOP-63BPLJG”;

    spinneritems = (Spinner) findViewById(R.id.spinneritems);

    connect = CONN(un, passwords, db, ip);
    String query = “select Name from Folio”;

    try {
    connect = CONN(un, passwords, db, ip);
    stmt = connect.prepareStatement(query);
    rs = stmt.executeQuery();
    ArrayList data = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(“Name”);
    data.add(id);

    }
    String[] array = data.toArray(new String[0]);
    ArrayAdapter NoCoreAdapter = new ArrayAdapter(this,
    android.R.layout.list_content, data);
    spinneritems.setAdapter(NoCoreAdapter);
    } catch (SQLException e) {
    e.printStackTrace();
    }
    spinneritems.setOnItemSelectedListener(new OnItemSelectedListener() {

    @Override
    public void onItemSelected(AdapterView parent, View view,
    int position, long id) {

    String name = spinneritems.getSelectedItem().toString();
    Toast.makeText(MainActivity.this, name, Toast.LENGTH_SHORT)
    .show();
    }

    @Override
    public void onNothingSelected(AdapterView parent) {

    }
    });

    }

    @SuppressLint(“NewApi”)
    private Connection CONN(String _user, String _pass, String _DB,
    String _server) {
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
    .permitAll().build();
    StrictMode.setThreadPolicy(policy);
    Connection conn = null;
    String ConnURL = null;
    try {

    Class.forName(“net.sourceforge.jtds.jdbc.Driver”);
    ConnURL = “jdbc:jtds:sqlserver://” + _server + “;”
    + “databaseName=” + _DB + “;user=” + _user + “;password=”
    + _pass + “;”;
    conn = DriverManager.getConnection(ConnURL);
    } catch (SQLException se) {
    Log.e(“ERRO”, se.getMessage());
    } catch (ClassNotFoundException e) {
    Log.e(“ERRO”, e.getMessage());
    } catch (Exception e) {
    Log.e(“ERRO”, e.getMessage());
    }
    return conn;
    }

    }

    Activity_main.xml

    AndroidManifest.xml

    Thanks a lot Sir.

    Fysal Usman

  5. Dear Sir,

    It seems I missed to copy-paste Activity_main.xml and AndroidManifest.xml. I am giving them hereunder

    AndroidManifest.xml

    Activity_main.xml

  6. I tried twice, but these xml files seem not being posted. If you give me your email, I can send them attaching as a text file or word file.

    Thanks a lot Sir.

  7. Dear Sir,

    When I checked the logcat, I found this line which appears to be forcing to stop the app:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mobledger/com.example.mobledger.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

    How to resolve this problem

    Thanks a lot Sir

    Fysal Usman

  8. Dear Sir,

    The abovementioned problem is solved as I changed ‘public class MainActivity extends AppCompatActivity’ to ‘public class MainActivity extends Activity’. After that, a new exception is thrown. In the logcat it says, ‘Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘java.sql.PreparedStatement java.sql.Connection.prepareStatement(java.lang.String)’ on a null object reference’. The referred sql statement is this:

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ip = “192.168.18.18”;
    un = “sa”;
    passwords = “12345678”;
    db = “SelectionShoes”;
    //server = “DESKTOP-63BPLJG”;

    spinneritems = (Spinner) findViewById(R.id.spinneritems);

    connect = CONN(un, passwords, db, ip);
    String query = “select Name from Folio”;

    try {
    connect = CONN(un, passwords, db, ip);
    stmt = connect.prepareStatement(query);
    rs = stmt.executeQuery();
    ArrayList data = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(“Name”);
    data.add(id);

    }
    String[] array = data.toArray(new String[0]);
    ArrayAdapter NoCoreAdapter = new ArrayAdapter(this,
    android.R.layout.list_content, data);
    spinneritems.setAdapter(NoCoreAdapter);
    } catch (SQLException e) {
    e.printStackTrace();

    I should feel obliged and remain ever grateful to you for helping to solve this problem.

    Fysal Usman

Leave a Reply

%d bloggers like this: