On Developing Android application, some application has needed only Portrait mode only (Game: Candy crush) or Portrait Orientation for an entire(full) app or particular on activity. Here we are sharing some common ways to achieve Portrait Mode. How to disable landscape mode for some of the views in my Android app? There are 2 ways to Read More…
Month: May 2018
Top 3 Android Interview Questions #2 (Android Developer)
If you are an Android experienced developer and want to prepare for Android Interview Questions. There are common Android interview questions that can make confuse you during an interview in top companies. Here we are sharing some common question which can help you crack the android interview. Read it and for more details, you can Read More…
Top 5 Android Interview Questions #1 (Android Developer)
Here are Android Interview Questions for the Experienced Android developer, these questions could make confuse you during an interview in top companies. As we all knew daily android app development growing in the market, so it’s important you have to always update own android skills. Here we are sharing some common and most asking question. Read More…
Program for find n’th node from the end of a Linked List
Question : Given a Linked List and a number n, write a program that find the value at the n’th node from end of the Linked List. Method 1 – Use length of linked list 1. Calculate the length of Linked List. Follow this tutorial Find Length of a Linked List data 2. Print Read More…
How to add an Android Studio project to GitHub
If you want to add Android Studio (Android application) project to a GitHub repository using android studio. How can I do that? Here is simple steps : Sign up and create a GitHub account in www.github.com. Download git from https://git-scm.com/downloads and install it in your system. Open the project in android studio and go to File -> Settings -> Version Read More…
Find the middle of a given linked list data structure
Question: In given a Linked List, find the middle of the list and print the number. Input : -> 4-> 2-> 7-> 9-> 1 Output : 7 Before starting you have to must know about Linked list and how to create it and Inserting node (data) in LinkedList. There is many approach to find middle number Read More…
Constraint Layout Advantage and example in kotlin
Constraint Layout The main advantage of ConstraintLayout is allows you to make large and complex layouts with a flat view hierarchy. No nested view groups like inside RelativeLayout or LinearLayout etc. You can make Responsive UI for android using ConstraintLayout and its more flexible compare to RelativeLayout. Before start if your beginner then follow this tutorial – Build Your Read More…
Determine if a string has all Unique Characters
Question : Determine giving string has all Unique Characters. Without Using additional data structures. Solution : Convert String to Char Array Sort Char Array Compare char[i ] == char[i+1] if true then String not has all uniques characters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import java.util.Arrays; public class Hello { public static void main(String ar[]) { // given String String str = "Rohit"; // char array char[] charsArray = str.toCharArray(); //sorting array Arrays.sort(charsArray); for (int i = 0; i < charsArray.length - 1; i++) { if (charsArray[i] == charsArray[i + 1]) { System.out.println("Unique character String : false"); break; } else System.out.println("Unique character String : false"); break; } } } |
Output : Unique character String : false RohitDegree in Computer Science and Engineer: App Developer and has multiple Read More…
Inserting a new node in a linked list data structure
Inserting new node in linked list can do 3 ways. At start of Linked list In the middle of Linked list At the end of Linked list Before starting you have to must know about Linked list and how to create it. 1. At Start of Linked list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package in.eyehunt.data.struc; public class LinkedList { Node head; // head of list // Linked list Node. class Node { int data; Node next; // Parameterized constructor Node(int d) { data = d; next = null; } } // method to add new node in start void push(int n) { //create new node Node newNode = new Node(n); // next node is head newNode.next = head; // move had point to new node head = newNode; } void printAllNodes() { Node node = head; while (node != null) { System.out.print("-> "+node.data); node = node.next; } } public static void main(String a[]) { //create a simple linked list with 4 nodes LinkedList linkedList = new LinkedList(); linkedList.push(1); linkedList.push(4); linkedList.push(3); linkedList.push(2); linkedList.printAllNodes(); } } |
2. In the Middle of Linked Read More…
Conditional (Ternary) Operator example – Basic java
Java ternary operator is the only conditional operator that takes three operands. Java ternary operator is a one liner replacement for if-then-else statement. Syntax condition ? expr1 : expr2 Description If condition is true, the operator returns the value of expr1; otherwise, it returns the value of expr2. Code
1 2 3 4 5 6 7 8 9 |
public class Hello { public static void main(String ar[]) { int a = 5; int b = 4 ; int max = a > b ? a : b; System.out.println("Maximum number is : " + max); } } |
Output Maximum number is : 5 RohitDegree in Computer Science Read More…