Skip to main content

Posts

Showing posts from December, 2017

Set Error Message on Spinner and EditText in Android when user cannot select any option

Notify user when Spinner and EditText is Empty I want to notify the user if the spinner field is not selected. How can I perform such a  notification   without using a Toast ? Try these line of code in your project which are give below: Write these of code on onCreate ( ) Method Here return  statement will stop the flow of your program Spinner Spinner remarks = (Spinner) findViewById(R.id. sp_remarks2 ) ; if ( remarksvalue .equalsIgnoreCase( "Select" )) { TextView errorText = (TextView) remarks .getSelectedView() ; errorText.setError( " Please Select Remarks" ) ; errorText.setTextColor(Color. RED ) ; //just to highlight that this is an error errorText.setText( "Please Select Remarks" ) ; return; } EditText EditText et_newreading = (EditText)findViewById(R.id. ed_light ) ; if ( newreadingvl .isEmpty()) { et_newreading .setError( "Please Enter Meter Reading" ) ; return; }

Create XML file from Arraylist in Android

                    Convert Arraylist data into XML Data  1. Declare an Arraylist outside the onCreate method ArrayList savejsonarray ; 2. Create an object of  Arraylist String tempXml = makeSendingData( savejsonarray ) ; Example: package com.lpu.lpuutilities ; import android.content.DialogInterface ; import android.content.Intent ; import android.support.v7.app.ActionBarActivity ; import android.os.Bundle ; import android.support.v7.app.AlertDialog ; public class MeterReadingBH7_BH8 extends ActionBarActivity { ArrayList mLevelArray , savejsonarray ; Button syncdata ; protected void onCreate (Bundle savedInstanceState) { super .onCreate(savedInstanceState) ; setContentView(R.layout. activity_meter_reading_bh7__bh8 ) ; syncdata = (Button) findViewById(R.id. syncbtn ) ; syncdata .setOnClickListener( new View.OnClickListener() { @Override public void onClick (View v) { tempXml = makeSendingData( savejsonarray ) ;

How to solve Multidexing problem in Android

            Steps to remove multidexing Problem in Android What is multidex file and why we need for the APK file? Android application (APK) files contain executable bytecode files in the form of  Dalvik Executable  (DEX) files, which contain the compiled code used to run your app. The  Dalvik Executable  specification limits the total number of methods that can be referenced within a single DEX file to  65,536 , including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a  multidex configuration . How to configure our application for multidex? 1. Add dependency in your app build.gradle (Module:app) and Click on Sync If your API Level is 20 or less than 20 you need to add support library dependencies { compile 'com.android.support:multidex:1.0.1' } But If your API Level is 21 or mo

How to get your PC MAC Address and Physical address using cmd

                           Steps  which you following carefully 1. Press  Window+R   . Run  window will open on your PC. 2. Write cmd   and press Enter key.  3.Type ipconfig /all  on cmd window .This command will all configration IP's of your PC.                                                               OR Type ipconfig on cmd window. this coommand will also gives your MAC address and physical address

Steps to get MAC Address And IP of your Android Device (Mobile Phone )

                     Follow these steps  in searlized  form:      1. Click on  'Setting ' App  of your Device.      2. Click on  'About phone' option.      3.Then Click on 'Status' option.                                                                       You can get your phone IP and MAC Address