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 - How to get just created Activity?

How to get just created Activity?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to get just created Activity?

Postby vadimz » Fri Feb 19, 2010 10:54 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent i = new Intent(Main.this, Main.class);                            
  2.  
  3. startActivity(i);
  4.  
  5. Activity created = ???;
Parsed in 0.020 seconds, using GeSHi 1.0.8.4


How can I get aceess to just created activity?

OR how else I can provide to new activity an object from current activity (not Int or String but my class) ?
vadimz
Developer
Developer
 
Posts: 44
Joined: Thu Jul 30, 2009 5:04 pm
Location: Moldova

Top

Postby sanyiii » Fri Feb 19, 2010 1:42 pm

Hi,

You can access static object from both of your activity.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ShareObject {
  2.  
  3.     private static Object obj;
  4.  
  5.  
  6.  
  7.     public static void setObject(final Object obj) {
  8.  
  9.         this.obj = obj;
  10.  
  11.     }
  12.  
  13.  
  14.  
  15.     public static Object getObject() {
  16.  
  17.         return obj;
  18.  
  19.     }
  20.  
  21. }
Parsed in 0.019 seconds, using GeSHi 1.0.8.4


And from the Activity class:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. ShareObject.setObject(myObject);
  3.  
  4. ...
  5.  
  6. MyObject obj = (MyObject)ShareObject.getObject();
  7.  
  8.  
Parsed in 0.019 seconds, using GeSHi 1.0.8.4


Or create a byte array from your object with ObjectOutputStream and ByteArrayInputStream, and put this byte array to the Intent object. :)
sanyiii
Developer
Developer
 
Posts: 42
Joined: Wed Jun 10, 2009 9:58 am

Postby vadimz » Fri Feb 19, 2010 4:25 pm

Thank you, I already was near both these ideas :)
Already made static objects, but I thought is a better way to transfer object-link direct.
vadimz
Developer
Developer
 
Posts: 44
Joined: Thu Jul 30, 2009 5:04 pm
Location: Moldova

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests