Skip to content

Instantly share code, notes, and snippets.

Avatar

Ayush Bansal bansalayush

  • India
View GitHub Profile
@bansalayush
bansalayush / GetImageSize.java
Created Mar 7, 2017
Get size of selected image in bytes
View GetImageSize.java
private void showFileChooser() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 2);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@bansalayush
bansalayush / CloneTest.java
Created Feb 28, 2017
Cloning example and concept
View CloneTest.java
/*
* Cloning creates an exact copy of the object
* While using = as in the example it creates a reference to same memory location but with different name
*/
import java.io.PrintStream;
public class CloneTest {
public static void main(String[] arrstring) throws Exception {
/*t1*/TestClass testClass1 = new TestClass(8798, 540.321);
/*t2*/TestClass testClass2 = (TestClass)testClass1.clone();
You can’t perform that action at this time.