Skip to content

Instantly share code, notes, and snippets.

View nasrabadiAM's full-sized avatar

Ali Nasrabadi nasrabadiAM

View GitHub Profile
@nasrabadiAM
nasrabadiAM / SerializeASerializable.java
Created September 10, 2018 07:57
Way to Serialize a Serializable Object
Person person = new Person();
person.setAge(22);
person.setName("Ali");
//write serializable object
FileOutputStream fileOutputStream = new FileOutputStream("file.txt");
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(person);
objectOutputStream.flush();
objectOutputStream.close();
@nasrabadiAM
nasrabadiAM / Person.java
Created September 10, 2018 07:54
A Serializable Class In Java
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
static String country = "IRAN";
private int age;
private String name;
//getter & setters
}
@nasrabadiAM
nasrabadiAM / intejIdea_Apache_copyright_notice_example.md
Last active September 4, 2018 11:00
IntejIdea Copyright notices.
@nasrabadiAM
nasrabadiAM / cisco.sh
Last active August 9, 2018 16:41
Bash Script For starting a cisco connection
#!/bin/bash
echo -e "yes\nusername\npassword" | sudo openconnect connectionUrl
@nasrabadiAM
nasrabadiAM / circleci-config.md
Last active November 23, 2018 10:30
CircleCI Configuration file

CircleCi Build System Configuration

1- Create .circleci folder in your project root beside app folder.

2- Add below file to this folder with name: config.yml

@nasrabadiAM
nasrabadiAM / config.yml
Created August 6, 2018 18:11
CircleCI Configuration file
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
@nasrabadiAM
nasrabadiAM / connect device over tcp.md
Created March 14, 2018 07:18
connect android device to adb over tcp wifi

connect to my device over tcp .bat file

first of all connect to the same local network that your pc is connected. then get your phone ip in your local network and create a .bat file with the following commands. start that bat file to connect to your phonr over tcp with wifi. now you can unplug your device cable. no cable needed any more.

@nasrabadiAM
nasrabadiAM / close software keyboard - android.java
Created February 18, 2018 16:40
close software keyboard - android
View view = activity.getCurrentFocus();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

what static keyword do in java and how to use it

static classes

you can not define static classes as general but subclasses can be static as a class member.

static methods