Posts

Showing posts from May, 2018

How to surf trough screens using screen timeout

Assume you have two activities First Activity and Second Activity. To go to the second activity from the first activity without tapping add the below code into the 'onCreate' class in the activity. Here we use the android Handler getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);new android.os.Handler().postDelayed(new Runnable() { @Override public void run() { Intent i1 = new Intent(FirstActivity.this, SecondActivity.class); startActivity(i1); } }, 3000); According to the above code the time it takes to go to the next screen it takes 3 seconds (3000 milli seconds)

Adding app bar to a single activity when it is removed from the styles.xml file

Add the following code into the .xml file <android.support.v7.widget.Toolbar android:id="@+id/my_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:elevation="4dp" android:theme="@style/ThemeOverlay.AppCompat.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> If you want to add a text into the app bar then add the following code into the onCreate class of the relevant activity. Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); setSupportActionBar(myToolbar);

Using buttons in Android

Screen change using buttons Create two activities. Here I'm using MainActivity(1st Screen) and the FunctionActivity(2nd Screen). Add a button to the splash activity layout and give a method name to the onClick action. <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Function" android:id="@+id/button3" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:width="150dp" android:onClick="fdemo"/> </Button> Then write the following method in the MainActivity public void fdemo (View v){ Intent i= new Intent(MainActivity.this, Function.class); startActivity(i); } Adding About message button(Using toast) Add a button to the  activity layout  and give a method name to the onClick action <Button android:layout_width="wrap_conte

Creating a simple application using Android Studio

Image
When you open the Android Studio the following screen will be prompted Select "Start a new Android Studio Project" Give a name to your project and click 'Next' Here you can choose the least version of android in  which your app can run. Then click 'Next' Select "Empty Activity" and click 'Next' Here you can give the "Activity Name"(Leave the 'Activity' part in your name) Then click 'Finish'

How to add a Date Validation in ADF

When imputing dates for Purchasing and Expiry there need to be a validation. That is the Expiry date must be always grater than the Purchased date. Using the following code in the .jsff code you can have the date validation. <af:validateDateTimeRange minimum="#{bindings.PurchasedDate.inputValue}" maximum="#{bindings.ExpiryDate.inputValue}" messageDetailNotInRange="Enter your message here"/>

ADF how to deploy an application

Creating an EAR First you must change the connection type of the database into "JDBC Data Source" from "JDBC URL" in the configurations of "AppModule". Then right click on the Application drop down and select Application properties. Then  expand Deployment and you'll find "Weblogic", select it. Then uncheck the box "Auto Generate and Synchronize weblogic-jdbc.xml Descriptors During Deployment" and click "OK". Then expand Run and you'll find "Weblogic", select it. Then select "Fast Swap"and click "OK"  Then right click on the Model in project tabs and select Deploy and wait until deployment is over then click "Application" tab and select deploy and in the popup select "Deploy to EAR" and select "OK" then wait until the deployment is over.  Go to the resource folder where your application is initially saved, there you can find a new folder

Java ADF creating EO and VO

Image
After creating a Data Base connection, Click the 'Applications Window options' and change the Package level to '1' Right click on Test Modal and create a new 'Entity Object' Click 'OK' Give a name to the entity object Type Testmodel. eo  for the package name. This creates a package named  eo  inside the  package Testmodel. Then click 'Browse' following to Schema Object You can choose the data base you connected earlier from the Database schema list Then  click Query and select the required table and double click then press 'OK' Click 'Next' Click 'Next' Select the attribute for the primary key and tick the Primary key check box and click 'Next' Click ' Next' Click 'Next' Click 'Finish' Right click on Test Modal and create a new 'View Object' Give a name to the view object and type Testmodel. vo  for the pa

Java ADF connecting to a Data Base

Image
When you open Oracle JDeveloper Studio you will be prompted to the following screen Select Connect to a Data Base Select 'Create a Data Base Connection' Give a name to your connection Select the connection  type you use. Here we are using a MySql Data Base Type the username and the password and give the Data Base name. Then test  the connection and press 'Ok' , if the connection is unsuccessful check  the  username, password and the Data Base name  Click the not started button and change it to 'Done'

Simple Calculator using java

Calculator with user input (Using scaner) Class = Cal import java.util.Scanner; public class Cal { public static void main(String[] args) { temp(); } public static void oparator(int x, int y,String oparator) { if("ADD".equals(oparator.toUpperCase())){ int z = x + y; System.out.println(z); } else if("SUB".equals(oparator.toUpperCase())) { int h = x - y; System.out.println(h); } else if("DIV".equals(oparator.toUpperCase())) { int i = x / y; System.out.println(i); } else if("REM".equals(oparator.toUpperCase())) { int j = x % y; System.out.println(j); } else if("MUL".equals(oparator.toUpperCase())) { int k = x * y; System

Creating "Hello World" java program

Image
Example Class = Simple class Simple{ public static void main (String args[]){ System.out.println("Hello World"); } } Sketch Copy the following java codes and replace data printed in green. Then run the java program. class  Simple {                 public static void main (String args[]){                                 System.out.println(" Hello World ");                 } } How to compile and run the above program using command prompt Copy the above sketch into the notepad and save it with the extension  .java  instead of  .txt Then open the command prompt and type,              cd  C:\Users\Inova\Desktop\new\Hello world     here (C:\Users\Inova\Desktop\new\Hello world) is the path of the folder in which the java file that you created before is saved. Then type,              javac  Simple .java and enter. by typing 'javac' we compile the java file. A new file called CLASS file will b