Hi all,
Before all sorry for my bad english 

I have a problem : 

I need to run a C code containing an infinite loop. This code will call 
some method in my Activity to create TextView.


To do that i have done this  :
in my onCreate() I start my C code, that is ok.

        new Thread(new Runnable() {
            public void run() {
                //code something u want to do
                invokeZamMain();                    
            }
        }).start();    


When my C code call a method, i can see in LogCat the corresponding trace.
But if I instanciate for example a TextView in this method ( called from 
C), the method "leaves" and return to C without instanciate my TextView.

I think it's because my thread is not the UI thread.
I've tried to runOnUiThread my C code but at any method call I got a SEGV
I alos tried to post a runnable into the mainLooper hander but no effect 
.... 

Is there a solution to do that ? 

Here is my method : 

     public void createZoneChamp(int id, int xTop, int yTop, int xBot, int 
yBot, int textSize, int colour){

        System.out.println("in createZoneChamp");
        
        RelativeLayout.LayoutParams layoutParams = new 
RelativeLayout.LayoutParams(
                (100), (50));
        
        layoutParams.setMargins( 20, 20, 0, 0); // margins as you wish
        System.out.println("okay");        
        TextView tv1 = new TextView(this);
        System.out.println("HI");
        tv1.setText("Price");
        tv1.setBackgroundColor(Color.RED);
        tv1.setTextSize(10);
        tv1.setGravity(Gravity.CENTER);
        tv1.setTextColor(colour);
        tv1.setLayoutParams(layoutParams);        
        
        relLayout.addView(tv1);    
        setContentView(relLayout);
            
    }

Thanks a lot !


-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to