View on Tabs in TabActivity

by Pankaj Deshpande » Thu, 22 Apr 2010 19:04:22 GMT


Sponsored Links
 Hi all,
I am working on a tab activity, and want images on each tab. I set
indicators as a view and set Image as background resource to each tab. For
each tab, I have started a new Activity and put a textview as a
setContentView in that. Up to my second last tab it works fine, but for lats
tab, all tabs cover my whole screen.
  Why is this happening?

 Thanks in Advance.

Pankaj Deshpande.
-- 
Android Application Developer
Pune.

--



View on Tabs in TabActivity

by Pankaj Deshpande » Thu, 22 Apr 2010 19:04:43 GMT


 Hi all,
I am working on a tab activity, and want images on each tab. I set
indicators as a view and set Image as background resource to each tab.
For each tab, I have started a new Activity and put a textview as a
setContentView in that. Up to my second last tab it works fine, but
for lats tab, all tabs cover my whole screen.
  Why is this happening?

 Thanks in Advance.

Pankaj Deshpande.
--
Android Application Developer
Pune.

--


Sponsored Links


View on Tabs in TabActivity

by pawan nimje » Thu, 22 Apr 2010 19:20:25 GMT


 Hey pankaj can you mail me your project .... i'll look into it n may i can
help you ..

-Pawan Nimje


On Thu, Apr 22, 2010 at 4:32 PM, Pankaj Deshpande



>



View on Tabs in TabActivity

by Sandeep Phansekar » Thu, 22 Apr 2010 21:59:12 GMT


 Hi

there r lots of example available for this solution
just googling u find the solution.

@Pankaj -- u working for which company ? actully i am serching the job in
pune for android position.

-- 
Regards
Sandeep







>>



Other Threads

1. Control a graphic with android buttons

Hello,

at the moment I'm not that much familiar with Android and I try to
teach it myself. My target is it to control a graphic with android
buttons, so at first I designed the layout:

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout android:id="@+id/FrameLayout01"
                     android:layout_width="fill_parent"
                     android:layout_height="fill_parent"
                     xmlns:android="http://schemas.android.com/apk/res/android">

                <TableLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:gravity="bottom"
                        android:stretchColumns="*"
                        android:layout_alignParentBottom="true">
                        <TableRow>
                    <Button
                        android:id="@+id/btnUp"
                        android:layout_width="80px"
                        android:layout_height="wrap_content"
                        android:text="Up"

                        />
                    <Button
                        android:id="@+id/btnEnter"
                        android:layout_width="70px"
                        android:layout_height="wrap_content"
                        android:text="Enter"
                        />
                    <Button
                        android:id="@+id/btnDown"
                        android:layout_width="80px"
                        android:layout_height="wrap_content"
                        android:text="Down"
                        />
                    </TableRow>
        </TableLayout>
</FrameLayout>

This seems to be what I want. Then I created a view and a thread:
--------------------------------------------
package my.domain.test;

public class GameThread extends Thread {
    private SurfaceHolder surfaceHolder;
    private GamePanelView gamePanel;
    private boolean run = false;

    public GameThread(SurfaceHolder surfaceHolder, GamePanelView
panel) {
        this.surfaceHolder = surfaceHolder;
        this.gamePanel = panel;
    }

    public void setRunning(boolean run) {
        this.run = run;
    }

    @Override
    public void run() {
        Canvas c;
        while (run) {
            c = null;
            try {
                c = surfaceHolder.lockCanvas(null);
                synchronized (surfaceHolder) {
                        gamePanel.updatePosition();
                    gamePanel.onDraw(c);
                }
            } finally {
                if (c != null) {
                    surfaceHolder.unlockCanvasAndPost(c);
                }
            }
        }
    }
}
-----------------------------
package my.domain.test;

public class GamePanelView extends SurfaceView implements Callback {

        private GameThread thread;
        private Bitmap ball;
        private int posX = 10, posY = 10;

        public GamePanelView(Context context, AttributeSet attrs)  {
                super(context, attrs);
                getHolder().addCallback(this);
                thread = new GameThread(getHolder(), this);
                createImages();
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int
width, int height) {
                // TODO Auto-generated method stub

        }

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
                thread.setRunning(true);
                thread.start();
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
        boolean retry = true;
        thread.setRunning(false);
        while (retry) {
            try {
                thread.join();
                retry = false;
            } catch (InterruptedException e) {
                //
            }
        }
        }

    @Override
    public void onDraw(Canvas canvas) {
        canvas.drawColor(Color.BLACK);
        canvas.drawBitmap(ball, posX, posY, null);
    }

    public GameThread getThread()  {
        return thread;
    }

    private void createImages()   {
        ball = BitmapFactory.decodeResource(getResources(),
R.drawable.ball);
    }

    public void updatePosition()  {
        //update Position
    }

}
---------------------------

Drawing the ball itself works and drawing the buttons itself works,
but I neighter know how to combine that nor I know how to listen to
these buttons (it's probably not onKeyDown, because I used this for
the d-pad). In earlier examples, I just used this xml as my main.xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:background="#000000"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <my.domain.test
      android:id="@+id/game"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"/>

</FrameLayout>

I can additionally define this in my previous xml file. This seems to
work too, no exceptions. But what do I have to do when I want to draw
graphics and those android buttons I defined in the xml file at the
same time? And what is the best approach to control the graphic with
those buttons? I hope that anybody can give my some useful hints.

Best Regards.


-- 

2. external input device

Hi

I'm looking to create an external input device for my G1 phone.  It
would plug into the USB port (where else!) and would contain a few
buttons on it that, when pressed, it would mimic the pressing of
certain keys on the physical keyboard.

The reason?
I'm looking to make an external controller for use with Nesoid,,
SNesoid, and Gensoid.

I've been looking up some information on the Android dev site like
KeyEvent, onKeyUp, onKeyDown, etc, etc..

But what I don't know is how to get android to listen to the input
signals from an external device coming in from the usb port.  Once I
figure that out I can convert or set them to equal the same as those
keyEvents. (something like that)

Hope this makes sense.

-- 

3. Programmatically setting a new default ringtone without the ringtone picker

4. Setting new default ringtone without using RingtonePicker?

5. Launch Activity from BroadcastReciever

6. Maths behind the Android orientation calculation algorithm

7. stuck in OnTouchEvent & OnClikc method. please help