Printing values

by Ramakrishna » Wed, 04 Mar 2009 02:03:07 GMT


Sponsored Links
 Hii everybody,

I`m working with an application in which i want to print  variable
values at runtime. But i`m not able to find any standard class or
method to do it. Can anyone of you help me in solving this problem?
has anyone tried out something similar before, it would be of gr8 help
if you can share your experiences with me.

Thanks...
Ramakrishna

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. how to add space between column in TableLayout

Hi i am just developing application in android . i am building a test
game TicTacToe . i am generating the GUI Programmatically  i know i
can develop the same gui using xml but again i am doing this for
learning .
 okay , i have created a TableLayout and add three TableRows in it and
each row i have created three buttons to create tictactoe interface .
the problem i am facing is that when i add buttons in column in table
row and run it there is no spacing between buttons. i have also use
setPadding() method but it adds spacing around the whole row not in
between columns ,

please help me resolving this issue , am i missing something thanks ..
i just was that i can't attached the image in the post , why is
that ..?
waiting anxiously for reply .

here is the code
-----------------------------------------------------------------------------------
package org.cprods.tictactoe;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;

public class GameScreen extends Activity{


        private TableLayout gameTable=null;
        private Button gameButtons[][]=null;
        private TableRow rows[]=null;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);

                gameTable=new TableLayout(this);
        //      gameTable.setGravity(Gravity.CENTER_HORIZONTAL);
                gameTable.setBackgroundColor(Color.BLACK);
                LayoutParams param=new LayoutParams
(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
                gameTable.setLayoutParams(param);
        //      gameTable.getLayoutParams
().height=ViewGroup.LayoutParams.FILL_PARENT;
        //      gameTable.getLayoutParams
().width=ViewGroup.LayoutParams.FILL_PARENT;
                gameTable.setStretchAllColumns(true);
                gameButtons=new Button[3][3];
                rows=new TableRow[3];
                int count=1;
                for(int i=0;i<3;i++)
                {
                        rows[i]=new TableRow(this);
                        rows[i].setPadding(5,5,5,5);
                //      rows[i].setLayoutParams(new LayoutParams
(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));


                        for(int j=0;j<3;j++){
                                gameButtons[i][j]=new Button(this);
//                              
gameButtons[i][j].setWidth((getWindowManager().getDefaultDisplay
().getWidth()/3-30));
//                              
gameButtons[i][j].setHeight((getWindowManager().getDefaultDisplay
().getHeight()/3-30));
                                gameButtons[i][j].setWidth(75);
                                gameButtons[i][j].setHeight(75);
                                
gameButtons[i][j].setBackgroundColor(Color.WHITE);
                                
//gameButtons[i][j].setGravity(Gravity.CENTER_HORIZONTAL |
Gravity.BOTTOM);
                                gameButtons[i][j].setText(""+count);
                                rows[i].setGravity(Gravity.CENTER_HORIZONTAL | 
Gravity.BOTTOM);
                                rows[i].addView(gameButtons[i][j]);
                                //rows[i].
                                count++;
                        }
                        gameTable.addView(rows[i]);
                }
                setContentView(gameTable);
                gameTable.postInvalidate();




        }
}




--~--~---------~--~----~------------~-------~--~----~

2. How to restart service with an intent already created

Hi all,

I am trying restart a service already started and calling to the first
intent created. I am doing it adding this line to the
AndroidManifest.xml in my service declaration:
<service android:enabled="true" android:name=".myservice"
android:process=":remote" android:launchMode="singleTask">

Also, I create the instance of the service like this:
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

But, when I launch the app twice I have this error:
ERROR/AndroidRuntime(733): java.lang.RuntimeException: Unable to start
service <myservice>d...@43599140 with Intent { action=<myservice>
flags=0x20000000 }: java.lang.IllegalThreadStateException: Thread
already started.

Does anybody how can I do it?

Thanks




--~--~---------~--~----~------------~-------~--~----~

3. How to get the screen dimension?

4. Begginer Questions

5. Decode subset of image

6. Selecting contact causes force close

7. Changing the application icon dynamically