Question about the Dialer Gui

by regui » Tue, 14 Apr 2009 13:43:54 GMT


Sponsored Links
 Hello everyone,

I am interested in knowing how to create a multi tab gui similar to
the dialer gui. By multi tab i mean the tabs for Dialer, call log,
contacts and favorites.

After searching all over I cannot figure out how to achieve this multi
tab setup. Could someone help me with this?

Thanks
--~--~---------~--~----~------------~-------~--~----~



Question about the Dialer Gui

by Jeff Hamilton » Tue, 14 Apr 2009 17:22:32 GMT


 To create an activity with tabs you want to use TabActivity
( http://d.android.com/reference/android/app/TabActivity.html ). The
dialer code that does this is available at
 http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git ;a=blob;f=src/com/android/contacts/DialtactsActivity.java;h=73d702b80c21d4e7a3af08a3fa025e15e4230b01;hb=HEAD.

-Jeff




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


Sponsored Links


Other Threads

1. Using GDATA from within Android for calendar access?

Hi,

I'm really just a beginner and fiddling a little bit around with java
and my G1. I'd like to create a calendar event from the phone and
learned, that there is no Android API for the calendar.

I thought it should be possible to access the google calendar via web.
I googled a bit and found some code to try. If I start it as a java
programm on my home pc, it works well and adds an event to my
calendar:

com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.extensions.EventEntry;
import com.google.gdata.data.extensions.When;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.URL;

public class TestMyCal {

       /**
        * @param args
        */
       public static void main(String[] args) throws IOException,
ServiceException {
       // Set up the URL and the object that will handle the
connection:
               URL postUrl = new URL("http://www.google.com/calendar/
feeds/MYEMAIL/
private/full");
       CalendarService myService = new CalendarService("exampleCo-
exampleApp-1");
               myService.setUserCredentials("MYNAME", "MYPASSWORD");

       EventEntry myEntry = new EventEntry();

       myEntry.setTitle(new PlainTextConstruct("My test event"));
       myEntry.setContent(new PlainTextConstruct("It might work."));

       Person author = new Person("It's me", null, "m...@home.com');
       myEntry.getAuthors().add(author);

       DateTime startTime = DateTime.parseDateTime
("2009-04-08T15:00:00-08:00");
       DateTime endTime = DateTime.parseDateTime
("2009-04-08T17:00:00-08:00");
       When eventTimes = new When();
       eventTimes.setStartTime(startTime);
       eventTimes.setEndTime(endTime);
       myEntry.addTime(eventTimes);

       // Send the request and receive the response:
       EventEntry insertedEntry = myService.insert(postUrl, myEntry);
   }

}

Great. Now I tried to put that into a Android application:

package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.extensions.EventEntry;
import com.google.gdata.data.extensions.When;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       // Set up the URL and the object that will handle the
connection:
       URL postUrl = null;
               try {
                       postUrl = new URL("http://www.google.com/
calendar/feeds/MYEMAIL/
private/full");
               } catch (MalformedURLException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }

       CalendarService myService = new CalendarService("exampleCo-
exampleApp-1");
               try {
                       myService.setUserCredentials("MYNAME",
"MYPASSWORD");
               } catch (AuthenticationException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }

       EventEntry myEntry = new EventEntry();

       myEntry.setTitle(new PlainTextConstruct("My test event"));
       myEntry.setContent(new PlainTextConstruct("It might work."));

       Person author = new Person("It's me", null, "m...@home.com');
       myEntry.getAuthors().add(author);

       DateTime startTime = DateTime.parseDateTime
("2009-04-08T15:00:00-08:00");
       DateTime endTime = DateTime.parseDateTime
("2009-04-08T17:00:00-08:00");
       When eventTimes = new When();
       eventTimes.setStartTime(startTime);
       eventTimes.setEndTime(endTime);
       myEntry.addTime(eventTimes);

               try {
                       EventEntry insertedEntry = myService.insert
(postUrl, myEntry);
               } catch (IOException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               } catch (ServiceException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }

       setContentView(R.layout.main);
   }
}

The program just runs fine, no errors (not using the emulator, not
using the G1) - but there is no calendar entry anywhere.

Any pro out there who can give me a hint, what I am doing wrong?

Greetings,
Andreas

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

2. Subclassed ImageView does not draw in Gallery View

I am subclassing the ImageView class and adding to the Gallery View.
But, nothing seems to get drawn in the expected location; though I can
fling through the Gallery list. I added an image from a resource, and
it shows up correctly in the Gallery.

Any idea on why this may be happening?

Here is the code I am using:
public class CustomCanvas extends Activity {
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       Gallery g = (Gallery) findViewById(R.id.gallery);
       g.setAdapter(new ImageAdapter(this));
   }

   private class CustomImageView extends ImageView {

       public CustomImageView(Context context) {
               this(context, null);
       }

       public CustomImageView(Context context, AttributeSet attrs) {
               this(context, attrs, 0);
       }

       public CustomImageView(Context context, AttributeSet attrs, int
defStyle) {
               super(context, attrs, defStyle);
       }

       protected void onDraw(Canvas canvas)
       {
           canvas.drawColor(Color.BLUE);
       }

   }

   private class ImageAdapter extends BaseAdapter{

       public ImageAdapter(Context c) {
           mContext = c;
       }

               public int getCount() {
                       return 2;
               }

               public Object getItem(int position) {
                       return position;
               }

               public long getItemId(int position) {
                       return position;
               }

               public View getView(int position, View convertView,
ViewGroup
parent) {

               if (position == 1)
               {
                   ImageView i = new ImageView(mContext);
               i.setImageResource(R.drawable.icon);
               return i;
               }
               else
               {
                       CustomImageView w = new CustomImageView
(mContext);
                       w.invalidate();
                       return w;
               }
       }

                private Context mContext;

   }

}
--~--~---------~--~----~------------~-------~--~----~

3. How could I put tab widget at the right or left side ?

4. is there best way to passing array buffer between Activity in same application

5. Problem Starting New Activity

6. Activity can't be displayed from a notification

7. WebView - issues with back button