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 - Program Logic Problem In Calling Another Class

Program Logic Problem In Calling Another Class

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

Program Logic Problem In Calling Another Class

Postby helloandroid » Fri Apr 04, 2008 3:11 pm

Hi,

I have the following program structure,

Activity_1 extends Activity , it calls Class_1 onCreate(),

that is Class_1 is loaded when the program (Activity_1) start to run.


In Activity_1, I make a menu to allow user to select "value_1" or "value_2",

but the selected value cannot pass to Class_1, since it is is already running.


So, do anyone have any idea on how to slove this logic problem?



Kindly Thanks,

helloandroid
helloandroid
Junior Developer
Junior Developer
 
Posts: 18
Joined: Sun Mar 02, 2008 6:51 pm

Top

Re: Program Logic Problem In Calling Another Class

Postby helloandroid » Sat Apr 05, 2008 3:58 am

please refer to the below post :o
Last edited by helloandroid on Sat Apr 05, 2008 4:12 am, edited 1 time in total.
helloandroid
Junior Developer
Junior Developer
 
Posts: 18
Joined: Sun Mar 02, 2008 6:51 pm

Postby helloandroid » Sat Apr 05, 2008 4:11 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Activity_1 extends Activity{
  2.  
  3.  
  4.  
  5.     private final int INPUT_1= 1;
  6.  
  7.     private final int INPUT_2 = 2;
  8.  
  9.     private int INPUT_TYPE = INPUT_1;
  10.  
  11.  
  12.  
  13.     public void onCreate(Bundle icicle) {
  14.  
  15.        
  16.  
  17.        super.onCreate(icicle);
  18.  
  19.        setContentView(R.layout.main);
  20.  
  21.        //.....
  22.  
  23.  
  24.  
  25.       public void onStart(){
  26.  
  27.          super.onStart();
  28.  
  29.          //...
  30.  
  31.         field.setInputMethod(new DInputMethod(INPUT_TYPE));    //calling another class
  32.  
  33.      }
  34.  
  35.  
  36.  
  37.     public void onRestart()
  38.  
  39.     {
  40.  
  41.         super.onRestart();
  42.  
  43.     }
  44.  
  45.     public void onStop()
  46.  
  47.     {
  48.  
  49.         super.onStop();
  50.  
  51.     }
  52.  
  53.  
  54.  
  55.       @Override
  56.  
  57.       public boolean onCreateOptionsMenu(Menu menu) {
  58.  
  59.         menu.add(1, INPUT_1, "Type1");
  60.  
  61.         menu.add(2, INPUT_2, "Type2");
  62.  
  63.         return super.onCreateOptionsMenu(menu);
  64.  
  65.       }
  66.  
  67.    
  68.  
  69.     @Override
  70.  
  71.     public boolean onPrepareOptionsMenu(Menu menu){
  72.  
  73.         onStop();
  74.  
  75.         return super.onPrepareOptionsMenu(menu);
  76.  
  77.     }
  78.  
  79.    
  80.  
  81.     @Override
  82.  
  83.      public boolean onOptionsItemSelected(Item item) { 
  84.  
  85.                  switch (item.getId()){
  86.  
  87.                 case INPUT_TRAD:
  88.  
  89.                         INPUT_TYPE=INPUT_1;
  90.  
  91.                         onRestart();
  92.  
  93.                         break;
  94.  
  95.                                
  96.  
  97.                 case INPUT_SIM:
  98.  
  99.                         INPUT_TYPE=INPUT_2;
  100.  
  101.                         onRestart();
  102.  
  103.                         break;
  104.  
  105.                 }      
  106.  
  107.               return super.onOptionsItemSelected(item);
  108.  
  109.        }
  110.  
  111. }
  112.  
  113.  
  114.  
  115.  
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


There are 2 problems,
NullException thrown when menu is clicked, &
this is not a good way, as INPUT_TYPE cannot pass to the DInputMethod class

anyone can help?

Kindly Thanks,
helloandroid :(
helloandroid
Junior Developer
Junior Developer
 
Posts: 18
Joined: Sun Mar 02, 2008 6:51 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 12 guests