Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Lauch an application with parameters

Lauch an application with parameters

Put your problem here if it does not fit any of the other categories.

Lauch an application with parameters

Postby cop3rfi3ld » Mon May 05, 2008 12:43 pm

Hi !

I have some problems with my application. I explain : in fact, i have some activities, linked with intents like that :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private void lancerCreerMulti() {
  2.  
  3.                 Intent i = new Intent(Accueil.this, Creer_multi.class);
  4.  
  5.                 startSubActivity(i, 0);
  6.  
  7.         }
Parsed in 0.020 seconds, using GeSHi 1.0.8.4


The problem is that in the parent activity, there an ArrayList, I would to be accessible by the subActivity. I tried to do something like :


// In the parent activity Accueil.java

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public ArrayList<String> getListeParties(){
  2.  
  3.                 ArrayList<String> res = this.listeParties;
  4.  
  5.                 if (this.listeParties.isEmpty()){
  6.  
  7.                         res=null;
  8.  
  9.                 }
  10.  
  11.                 return res;
  12.  
  13.         }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


// In the subActivity

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Accueil ac = (Accueil)this.getParent();
  2.  
  3. liste = ac.getListeParties();
Parsed in 0.010 seconds, using GeSHi 1.0.8.4



but i get a null pointer exception.
So can I send my list in parameter with the Intent and get it back in the subActivity ?
Why my two classes cant communicate like that ?
How may I do it ?


Thank for your answers.......


Cop3rfi3ld
cop3rfi3ld
Freshman
Freshman
 
Posts: 2
Joined: Mon May 05, 2008 12:36 pm

Top

Postby plusminus » Fri May 16, 2008 11:09 am

Hello cop3rfi3ld,

passing values (parameters) to other Activities is done by putting a Bundle to the Intent, like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 Intent i = new Intent();
  2.  
  3.  
  4.  
  5.                 Bundle b = new Bundle();
  6.  
  7.                 b.putString("KEY", "VALUE");
  8.  
  9.  
  10.  
  11.                 i.putExtras(b);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 18 guests