Random password generator program in Java?

♠ Posted by ANDROID THIRST in

A simple program in Java that generates a random password combination of Character, Number, Special symbols.


Here is the code snippet to generate random password in java..........

package password.generater;

import java.util.Random;

/**
 *
 * @author dell
 */
public class PasswordGenerater {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int length= 8;
        System.out.println(generatePswd(length));
        
        // TODO code application logic here
    }
    static char[] generatePswd(int len){
        System.out.println("Your Password ");
        String charsCaps="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
        String Chars="abcdefghijklmnopqrstuvwxyz";
        String nums="0123456789";
        String symbols="!@#$%^&*()_+-=.,/';:?><~*/-+";
        String passSymbols=charsCaps + Chars + nums +symbols;
        Random rnd=new Random();
        char[] password=new char[len];
        int index=0;
        for(int i=0; i<<len;i++){
            password[i]=passSymbols.charAt(rnd.nextInt(passSymbols.length()));
        }
      return password;
        
    }
}
/>

If you have any doubt then comment below.......
HAPPY PROGRAMMING

How to print following number pattern in java?

♠ Posted by ANDROID THIRST


Here is the code snippet to print this number pattern in java..........
public class Pattern1 {
    public static void main(String[] args) {
      
        for(int i=1;i<=5;i++){
            for(int k=5;k>=i;k--){
                System.out.print(k);
            }
            System.out.println();
           
    }
   
    }
}
HAPPY PROGRAMMING

What is the difference between xml based and Java based user interface?

♠ Posted by ANDROID THIRST in
Have you ever find trouble to differentiate between android based and java based layout creation.
In this article, I am going to give you a brief demonstration about how to differentiate between these two way.
The basic building block of Android UI is the layout. A layout defines the visual structure for a user interface . You can arrange layout in two different ways .

1. Declaring UI element in XML :-  This is most preferable method use to create the user interface in android. We can use this method  when we want to create a simple static user interface in our android application. We used this method when the layout does not change . Suppose you are going to create UI for the login screen , for creating this we used XML because the layout does not change the login screen in future.


2. Declaring UI element in Java:- In terms of strengths of Java coding approach to layout creation ,
perhaps the most significant advantage that java has over XML resource files comes into play when dealing with the dynamic user interface. XML resource files are inherently  most useful when defining static layouts, In other words, the layouts that are unlikely to change significantly from one invocation of an activity to next. On the other hand, Java code is ideal for creation user interface dynamically at run-time.This is particularly important in situations where  the user interface may appear differently each time the activity execute subject to an external factor. 

Android resource management and activity Lifecycles

♠ Posted by ANDROID THIRST in ,
What is an Activity?
An activity is a single, focused thing that the user can do. Almost all activity interact with the user,
So the activity class takes care of creating a window for you in which you can place your UI.

Android Process State :-  Process host applications and applications are made up of components .
within Android system, the current state of the system is defined by the highest - ranking active component within the application that it hosts. A process can be in one of the following five states
at any given time :

Foreground Process:- These processes are assigned the highest level of priority.At any one times, there are unlikely to be more than one or two foreground process active and these are usually the last to be terminated by the system. It's an activity with which the user currently interacting.

Visible Process:- A process containing an activity that is visible to the user but is not the activity with which the user is interacting is classified as a “visible process”. This is typically the case when an activity in the process is visible to the user but another activity, such as a partial screen or dialog, is in the foreground.

Service Process:- Processes that contain a Service that has already been started and is currently executing.

Background Process:- A process that contains one or more activities that are not currently visible to the user, and does not host a Service that qualifies for Service Process status. Processes that fall into this category are at high risk of termination in the event that additional memory needs to be freed for higher priority processes.

Empty Process:-Empty processes no longer contain any active applications and are held in memory ready to serve as hosts for newly launched applications. This is somewhat analogous to keeping the doors open and the engine running on a bus in anticipation of passengers arriving.

Activity Stack:-For each application that is running on an Android device, the runtime system maintains an Activity Stack. When an application is launched, the first of the application’s activities to be started is placed onto the stack. When a second activity is started, it is placed on the top of the stack and the previous activity is pushed down. The activity at the top of the stack is referred to as the active (or running) activity. When the active activity exits, it is popped off the stack by the runtime and the activity located immediately beneath it in the stack becomes the currently active activity.

What is Activity Lifecycle?


The class Activity provides a number of well-defined methods that are called when an application is started, suspended , restarted and so on. An activity can be in one of a number of different states during the course   of it execution withing an application.

Active State:-The activity is at the top of the Activity Stack, is the foreground task visible on the device screen, has focus and is currently interacting with the user.

Paused State:-  The activity is visible to the user but does not currently have focus.

Stop State:- The activity is currently not visible to the user.

Killed:- The Activity has been terminated by the runtime system in order to free up memory and is no longer present on the Activity Stack.



Java Program to print pattern

♠ Posted by ANDROID THIRST in













Program to create this pattern in java is :-

public class Pattern1 {
    public static void main(String[] args) {
        int r=14;
        for(int i=1;i<=5;i++){
            for(int j=1;j<=r;j++){
                System.out.print("-");
            }
            for(int k=1;k<=i;k++){
                System.out.print("#");
            }
            r=r-2;
            System.out.println();
        }
    }
   
}
   
"HAPPY PROGRAMMING"

How to work with button in android?

♠ Posted by ANDROID THIRST in
Buttons are the type of view that is created to be pressed . When the user clicks on the button in an android application the application is respond something. In this tutorial, we are going to create a different type of button .


There are three types of button in android
1.Button with Text
2. Button with Image
3.Button with Text and Image

1. Button with Text:-

Step 1. Create a project buttonWidget.

Step 2. Add following code in activity_main.xml


     
<
     Button 
 android:id="@+id/button1"
 android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:text="ClickMe" 
android:textsize="30dp"
android: background="#0000aa" />
2. Button with Image: -

 Just under the Text button use ImageButton view to create an ImageButton . Put the following code just under the Text button.
<
ImageButton
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/imageButton"
      android:layout_centerVertical="true"
      android:layout_centerHorizontal="true"
      android:src="@mipmap/ic_launcher"/>
3.Button with Text and Image:- We can also create a button with Text and Image both . We can put text Left, Right, Above, 
Bellow of the Image .
'
<Button android:id="@+id/button" 
style="?android:attr/buttonStyleSmall" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="android" 
android:drawableLeft="@minmap/ic_launcher"
android:drawablePadding="10dp"/>
<HAPPY CODING>

How to create Number Pattern in Java?

♠ Posted by ANDROID THIRST in












A number pattern in java is a simple program    that is asked by the programmer to check their command on the loop. Here I described how to  create a simple number pattern in java. There are following step you need to follow to create a number pattern.
1. Have a clear perception in your mind what you want to create.
2. Don't just create Take a copy pen and firstly create it on your copy
3. Draw this practice more and more


public class numExample {
   static int i;
   static int j;
    public static void main(String[] args) {
       
        for(i=1; i<=5; i++)
               {
              for(j=1;j<=i;j++)
              {
                 System.out.print(j);  
       }
            System.out.println("");
           
        }
    }



"HAPPY PROGRAMMING"

Why choose android over any other mobile application development

♠ Posted by ANDROID THIRST in
Android is open source software platform based on Linux kernel and design primarily for touchscreen mobile such as Smartphone, Tablet. It's a  complete stack of- OS, Middleware, and applications .Android Inc. is founded by Palo Alto of California, U.S. by Andy Rubin, Rich miner, Nick sears and Chris White in  October 2003. In 2008, android would first be released by T-Mobile as the T-Mobile G1.Later Android Inc. was acquired by Google in 2005.
So the question is why should we choose android over any other mobile application development platform ?
There are lots of reason why you choose android development over any other mobile application development platform

1. JAVA PROGRAMMING:-  One of the biggest reasons why many developers choose android over any other mobile application development due to Java programming. Java has been in the market for a very long time. Java is used by android to develop application. Java supports a rich set of Java libraries that are used by androids. So you can use all the feature of Java in your android programming.


2.LARGE MARKET SHARE:-  The latest survey shows that android is hot in the market. Its market share now acquired by android phones. According to the survey that held in 2015 found that over 40% of developer uses android as their priority target platform. There are 1 billion devices activated that uses android. For any developer looking to maximize their potential users android is the obvious choice

3. OPEN SOURCE:-  
The android operating system is designed  to be free and open. All the mobile manufacturer just download it and use it. there are billions of applications that are available on google play store that are totally free.

4.Lower Requirement :-The developer can work on any machine like windows, Linux, or on IOS and started just in 25 $. Instead of mac who need 99$ annually for their app accounts

5. EASY TO LEARN:-  
        Due to a lot of predefined libraries android is easy to learn . If you have a good understanding of java you can develop an android application very easily or with some more practice you can develop and smart level app very easily .
                   

                      
                                               "HAPPY PROGRAMMING"