Free Android App

Passing data between activities in Android

Objective :

  • Passing data between activities in Android
  • Passing multiple data between activities in Android
  • Passing array between activities in Android
  • Passing ArrayList between activities in Android
  • Passing ArrayList to another activity in Android
  • Sending data via Intent in Android
  • Sending multiple data via Intent in Android
  • Sending array between activities in Android
  • Sending ArrayList between activities in Android
  • Sending ArrayList to another activity in Android
  • Sending data via Intent and Bundle in Android
  • Sending multiple data via Intent and Bundle in Android
  • Passing array between activities in Android using Intent and Bundle
  • How to pass array to another activity in Android?
  • How to pass array between activities in Android?
  • How to pass data to another activity in Android?
  • How to pass data to activity in Android?
  • How to pass data to between activities in Android?
  • How to pass ArrayList to another activity in Android?
  • How to pass ArrayList between activities in Android?

 

Code for passing data between activities in Android :

ActivityOne.java

[sourcecode lang=”java”]

String value = "Hello!";
Intent in = new Intent(this,ActivityTwo.class);
in.putExtra("Key", value);
startActivity(in);

[/sourcecode]

ActivityTwo.java

[sourcecode lang=”java”]

Bundle bundle = getIntent().getExtras();
String valueReceived = bundle .getString("Key");

[/sourcecode]

 

Code for passing multiple data or values between activities in Android :

Method 1 : Using Intent to pass data and Bundle to extract data between activities in Android

ActivityOne.java

[sourcecode lang=”java”]

String value1 = "Hello!";
String value2 = "Hi!";
Intent in = new Intent(this,ActivityTwo.class);
in.putExtra("Key1", value1);
in.putExtra("Key2", value2);
startActivity(in);
[/sourcecode]

ActivityTwo.java

[sourcecode lang=”java”]
Bundle bundle = getIntent().getExtras();
String valueReceived1 = bundle .getString("Key1");
String valueReceived2 = bundle .getString("Key2");
[/sourcecode]

 

Method 2 : Using Bundle to pass and to extract data between activities in Android

ActivityOne.java

[sourcecode lang=”java”]

String value1 = "Hello!";
String value2 = "Hi!";
Intent in = new Intent(this,ActivityTwo.class);
Bundle bundle = new Bundle();
bundle.putString("Key1", value1);
bundle.putString("Key2", value2);
in.putExtras(bundle);
startActivity(in);
[/sourcecode]

ActivityTwo.java

[sourcecode lang=”java”]
Bundle bundle = getIntent().getExtras();
String valueReceived1 = bundle .getString("Key1");
String valueReceived2 = bundle .getString("Key2");
[/sourcecode]

 

Code for passing array between activities in Android :

ActivityOne.java

[sourcecode lang=”java”]
String[] array = new String[]{"Item1", "Item2", "item3", "Item4", "item5"};
Intent in = new Intent(this,ActivityTwo.class);
Bundle bundle = new Bundle();
bundle.putStringArray("MyArray", array);
in.putExtras(bundle);
startActivity(in);
[/sourcecode]

ActivityTwo.java

[sourcecode lang=”java”]
Bundle bundle = getIntent().getExtras();
String arrayReceived[] = bundle.getStringArray("MyArray");
[/sourcecode]

 

Code for passing ArrayList between activities in Android :

ActivityOne.java

[sourcecode lang=”java”]
ArrayList<String> array = new ArrayList<String>();
array.add("Hello");
array.add("Hi");
array.add("Bye");
Intent intent = new Intent(this, ActivityTwo.class);
intent.putExtra("array_list", array);
startActivity(intent);
[/sourcecode]

ActivityTwo.java

[sourcecode lang=”java”]
Bundle bundle = getIntent().getExtras();
ArrayList<String> array = (ArrayList<String>) bundle.getStringArrayList("array_list");
[/sourcecode]


Have fun with Intent.

LightMeUp – Flashlight Application for Android

LightMeUp – Flashlight Application for Android

It is a small application which uses the Camera Flash to enlighten and which may also help you in searching something in dark. The best part is it works in a single click on  your Android phone with or without flash. If your phone does not have flash, it will set brightness of your phone to maximum, as soon as you close application it will set brightness back to original.

This application was developed as a part of Android Training we provide at AnCyber, Pune (India).


Get it on Google Play

Go, download and get enlightened.

Auto Profiler – Change profiles automatically

Auto Profiler

Auto Profiler

Auto Profiler is basically a profile manager which automatically switches your profiles based on PS locations that and ranges that are suggested by the user. It has many other features to make you sit in a comfort zone when you are at home, office, college, party, driving, etc.

Being an Android and Java Trainer I do conduct lot of training sessions all over India and face many people right from hardcore professionals to students but there is one common problem with most of them is they need to turn their phone to silent before entering training room and switch phone back to loud after training and many of them just forgot to do it and phone rings during training which results in lack of concentration of some trainees and trainer as well sometime. Many of them even forget to switch it back to load and they miss some important calls.

Auto Profiler is the best solution for them. It is very simple to use, and you just need to set once and forget it for rest of your life. This can be achieved with only steps as follows;

  1. At first user is asked to create their own profile, lets say silent using Profile option.
  2. Get Location and set profile for particular place using Place option of the app.

Once you are done, you don’t need to worry about accidentally ringing of your phone in meetings, training, and classroom. As soon as you walks in to college, it will put your phone on silent and as soon as you walks out of college your phone again will be on loud.

We also have a Setting option here, if you need your phone on silent on some date and for specific interval for example 2 hours then you can set it using Setting option by simply selecting date, start time and end time and you are done.


Get it on Google Play

OR

Scan this QR Code to Download Auto Profiler:

Download Auto Profiler for Free

Download Auto Profiler for Free

Click here to like us on Facebook.

FLAMES

FLAMES

FLAMES

I have developed the well known game FLAMES (Friend – Love – Affection – Marriage – Enemy – Sibling) on Android & J2ME Platforms, have a look at the Android version of the FLAMES, very soon it will be available with Google Play to download for free of cost.

FLAMES allows you to check out the relationship between two people just by entering their names & single click on “?” button.

Download FLAMES from Google Play for free now.

If you like FLAMES, like Facebook Page of FLAMES.

Checkout Video to know how FLAMES works :

[gigya src=”http://player.videofy.me/player.swf?videoId=702646″ width=”480″ height=”360″ quality=”high” wmode=”transparent” allowFullScreen=”true”]

Download & have great fun while checking relations on the go.