[android-beginners] integrating gmail in android app

2010-03-01 Thread gganesh
Hi group,
I need the user to login to gmail within my app ,as they login ,a hard
coded message is send to the To address they have entered and return's
back to my view .
How is this possible in android
ganesh

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: integrating gmail in android app

2010-03-01 Thread gganesh
 Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String[] recipients = new 
String[]{x...@gmail.com,
,};

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, Test
Hello);

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, This is
email's message);
emailIntent.setType(text/plain);
startActivity(emailIntent);


The above snippet works fine for sending email hence i have already
entered the subject and text field ,is there any option to send email
at one click.In this case first i have to chose mail or message option
then it takes me to another screen where we can enter subject and
text .I need to skip those two steps ,any options


On Mar 2, 6:28 am, gganesh ganesh@gmail.com wrote:
 Hi group,
 I need the user to login to gmail within my app ,as they login ,a hard
 coded message is send to the To address they have entered and return's
 back to my view .
 How is this possible in android
 ganesh

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] google gdata Calender api problems with android

2010-02-22 Thread gganesh
Hi group,
I trying to use Datepicker widget to select the date and pass to
google gdata api to fetch calender events

private DatePickerDialog.OnDateSetListener mDateSetListener =
new DatePickerDialog.OnDateSetListener() {

public void onDateSet(DatePicker view, int year,
  int monthOfYear, int dayOfMonth)
{

mYear = year;
mMonth = monthOfYear+1; // why is that step up is
needed
mDay = dayOfMonth;
updateDisplay();
}
};

private void updateDisplay() {

StringBuilder status= new StringBuilder(50);
String y1=String.valueOf(mYear);
String m1=String.valueOf(mMonth);
if(m1.length()==1)
{
m1=0+m1;
}
String d1=String.valueOf(mDay);
if(d1.length()==1)
{
d1=0+d1;
}


String startdate=y1+-+m1+-+d1+T+00:00:00;
//example out put for startdate:2009-02-12T00:00:00
String enddate=y1+-+m1+-+d1+T+23:59:59;

try{
myQuery.setMinimumStartTime(DateTime.parseDateTime(startdate));
myQuery.setMaximumStartTime(DateTime.parseDateTime(enddate));;
Feed resultFeed = myService.query(myQuery, Feed.class);
for (int i = 0; i  resultFeed.getEntries().size(); i++) {
  Entry entry =  resultFeed.getEntries().get(i);
  status.append(\t + entry.getTitle().getPlainText());

}
   }catch(Exception e){System.out.println(e);}

   mDateDisplay.setText(status);

 }

I will be glad if someone clarifies few points

1. Why is that this step up is needed -  mMonth = monthOfYear+1;
2. DateTime.parseDateTime(String args) takes date format as
2009-02-12T00:00:00 and is there any other simple approach to convert
int values from Datepicker to required format,the one shown above
doesn't work .At present i hard-code  values to make it work ,like

myQuery.setMinimumStartTime(DateTime.parseDateTime(2010-02-12T00:00:00));

myQuery.setMaximumStartTime(DateTime.parseDateTime(2010-03-12T23:59:59));

3. The code works fine(when i hard code the as shown above) for the
very time of execution .when i clicked back button and again tried to
run the app ,resultFeed throws Null pointer exception.

I could appreciate your valuable suggestion to correct my mistakes.

Thanks
ganesh

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Why I couldn't retrieve the phone number from intent in onReceive of BroadcastReceiver

2009-09-09 Thread gganesh

hi,
This is a simple application which sends  group  sms (a group consist
only 5 phone numbers )and i have registered  a Broadcast to announce
as sms is send .here i need to display the number to which the
sms is send ,how to do that
here is my code
# In onCreate()

 button is pressed it triggers  an onClick event and sends the group
sms
public void onClick()
{
  for (int j = 0; jphonenos.length;j++)
   {
sendSMS(phonenos[j],mess);
  }
}
 String SENT = SMS_SENT;
 private void sendSMS(String phoneNumber, String message)
   {

 Intent ss=new Intent(SENT);
ss.putExtra(phno1, phoneNumber); //*I added this line so
that later i can retrieve the ph no
 PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,ss,0);
 SmsManager sms = SmsManager.getDefault();
 sms.sendTextMessage(phoneNumber, null, message, sentPI, null);
}

public void onStart()
   {
   super.onStart();
   br_send=new BroadcastReceiver(){
   @Override
   public void onReceive(Context arg0, Intent arg1) {
   switch (getResultCode())
   {
   case Activity.RESULT_OK:
  Toast.makeText(getBaseContext(), SMS
sent,  Toast.LENGTH_SHORT).show();

   Log.v(TAGS,intent  :+arg1.getExtras
().getString(phon1)); //*error *
}
   }
   };

   registerReceiver(br_send,new IntentFilter(SENT));
}

 public void onStop()
   {
   super.onStop();
   unregisterReceiver(br_del);
}
an error is thrown at arg1.getExtras().getString(phon1) Log
statement  ,is this a right approach to display the number to which
the sms is send

error is
java.lang.RuntimeException: Error receiving broadcast Intent
{ action=SMS_SENT } in seaant.android.panicmessag...@437489e8
 Caused by: java.lang.NullPointerException

may be i misunderstood the concept of intent ,Help me to solve this
error
Thanks
Ganesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] LocationManager.getLastKnownLocation(gps) returns null instead of location object

2009-08-28 Thread gganesh

hi,
locationmanger = (LocationManager)getSystemService
(Context.LOCATION_SERVICE);
location =locationmanager.getLastKnownLocation(gps);
Log.v(TAG,location obj+location);

The Log shows null instead of location object

I am using emulator to test my code ,I have written appropriate
permissions,i am using android1.5 ,
I could not figure out the reason
In eclipse after switching to DDMS mode , Emulator Controls tabs shows
Location Controls. From here, we can view longitude/latitude
coordinates to the device.Is there any way to bring down those data
into my activity . Is this only way to get longitude and latitude when
test with emulator.
Please guide me
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Understanding onKeyDown

2009-04-23 Thread gganesh

hi Mark ,
Thanks for your reply ,
but still I'm not aware why, only when the press() is commented out
from onKeyDown() method
(i can say from logcat) ,the onKeyDown is invoked for every hit of the
appropriate key .When I run the program without commenting press()
from onKeyDown ,the call back method onKeyDown is called only once for
the very first-time hit on the key.why is this varied behavior.




On Apr 22, 5:42 pm, Mark Murphy mmur...@commonsware.com wrote:
 gganesh wrote:
  I wrote a simple program using SimpleAdapter to populate list view .To
  do this i modified the existing notepad example and try using
  onKeyDown instead of onCreateOptionMenu .Here i can activate the
  onKeyDown method for first time only,for the second press, on the
  appropriate key, the onKeyDown is not called ,I can say this from
  logcat output.I could not guess the reason .

 If I had to guess, I would say that the ListView is intercepting your
 KEYCODE_DPAD_CENTER events.

 To prove this, try switching to some other key that ListView does not
 handle itself. If you then get both events, that means my guess is correct.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Understanding onKeyDown

2009-04-22 Thread gganesh

hi,
I wrote a simple program using SimpleAdapter to populate list view .To
do this i modified the existing notepad example and try using
onKeyDown instead of onCreateOptionMenu .Here i can activate the
onKeyDown method for first time only,for the second press, on the
appropriate key, the onKeyDown is not called ,I can say this from
logcat output.I could not guess the reason .Any clarification on this
is appreciable.
this is my code

public class SimpleAdapter1 extends ListActivity {
/** Called when the activity is first created. */
 ArrayListHashMapString,String arr =new
ArrayListHashMapString,String();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SimpleAdapter sim =new SimpleAdapter(this,
 
arr,
 
R.layout.main1,
 
new String[] {list1,list2},
 
new int[] {R.id.list1,R.id.list2});
Log.d(getClass().getSimpleName(),In onCreate);
setListAdapter(sim);

   }
public boolean onKeyDown(int keyCode, KeyEvent ev)
{
switch(keyCode)
 {
case KeyEvent.KEYCODE_DPAD_CENTER:
Log.v(SimpleAdapter,Key DPAD CENTER pressed);

press();
return true;
default:
return false;
 }


}//onkeyDown

public void press()
{
long timel=System.currentTimeMillis();
Log.d(Current time is  :  ,Long.toString(timel));

HashMapString,String  hm=new HashMapString,String();
hm.put(list2, Long.toString(timel));
hm.put(list1, Now Time is :);
a.add(hm);
SimpleAdapter sim1 =new SimpleAdapter(this,a,R.layout.main1,new
String[] {list1,list2},new int[] {R.id.list1,R.id.list2});
setListAdapter(sim1);
}

}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: Problem with Emulator

2009-03-30 Thread gganesh

Thanks David for your reply
I got the problem solved by clearing all files under .android folder




On Mar 30, 5:00 pm, David Turner di...@android.com wrote:
 it looks like there is something fishy in your system image. Try starting
 with emulator -wipe-data once to see if this solves the issue.
 If it doesn't, try re-downloading the SDK.

 If that doesn't solve the issue, let us know by giving us as much detail as
 possible as to what you do to build/install/start your
 application.

 On Mon, Mar 30, 2009 at 6:03 AM, gganesh ganesh@gmail.com wrote:

  hi ,
  I could launch any application on emulator has it shows error like

   ERROR/mountd(19): could not read initial mass storage state
   ERROR/flash_image(28): can't find recovery partition
  DEBUG/AndroidRuntime(23):  AndroidRuntime START
  
  DEBUG/AndroidRuntime(23): CheckJNI is ON
  ERROR/dalvikvm(23): Unable to find run() in java.lang.Thread
  DEBUG/dalvikvm(23): VM cleaning up
  DEBUG/dalvikvm(23): LinearAlloc 0x0 used 15972 of 4194304 (0%)
  WARN/dalvikvm(23): JNI_CreateJavaVM failed
  ERROR/AndroidRuntime(23): JNI_CreateJavaVM failed
  INFO/(24): ServiceManager: 0xaab8
  INFO/AudioFlinger(24): AudioFlinger's main thread ready to run.
  INFO/CameraService(24): CameraService started: pid=24
  DEBUG/RILD(22): overriding with -s /dev/socket/qemud_gsm
  DEBUG/AndroidRuntime(48):  AndroidRuntime START
  

  I could not figure out what went wrong
  I'm using Ubuntu 8.4
  Eclipse 3.4
  java 1.6

  Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Problem with Emulator

2009-03-29 Thread gganesh

hi ,
I could launch any application on emulator has it shows error like


 ERROR/mountd(19): could not read initial mass storage state
 ERROR/flash_image(28): can't find recovery partition
DEBUG/AndroidRuntime(23):  AndroidRuntime START

DEBUG/AndroidRuntime(23): CheckJNI is ON
ERROR/dalvikvm(23): Unable to find run() in java.lang.Thread
DEBUG/dalvikvm(23): VM cleaning up
DEBUG/dalvikvm(23): LinearAlloc 0x0 used 15972 of 4194304 (0%)
WARN/dalvikvm(23): JNI_CreateJavaVM failed
ERROR/AndroidRuntime(23): JNI_CreateJavaVM failed
INFO/(24): ServiceManager: 0xaab8
INFO/AudioFlinger(24): AudioFlinger's main thread ready to run.
INFO/CameraService(24): CameraService started: pid=24
DEBUG/RILD(22): overriding with -s /dev/socket/qemud_gsm
DEBUG/AndroidRuntime(48):  AndroidRuntime START



I could not figure out what went wrong
I'm using Ubuntu 8.4
Eclipse 3.4
java 1.6

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Can we get the Cursor Object in a Service

2009-03-26 Thread gganesh

Hi group,
I need to access contact list from the  Service ,how to get the Cursor
object
In Activity we write
Cursor c=managedQuery(Contacts.People.CONTENT_URI,null,null,null)
What can i do to get the cursor in a Service .
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] How can my application be intimated whenever i edit my contact list

2009-03-24 Thread gganesh

Hi group,
I need to generate an xml file every time  for the details in the
contact list when there is a new addition or when i edit my contact
list .Is there any listener available to invoke a callback method
when  changes happen to my contact list?
Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] As the Key is pressed the onKeyDown method is never called

2009-03-20 Thread gganesh

Hi ,
I wrote a custom view where i use onDraw() to apply a color and call
a method insert() to do some modification and call invalidate in
insert() method to redraw ,so onDraw and insert method will be
calling recursively .I wrote a onKeyDown method but this is never
called as i press the relevant key ,i could not figure out the resons
please help me out.

boolean flag = true;
public void onDraw(Canvas c)
{

Paint p=new Paint();
p.setColor(Color.RED);
p.setTextSize(50.0f);
p.setAntiAlias(true);
c.drawARGB(23, 44, 145, 78);
if(flag)
{
c.drawColor(Color.BLUE);
}
else
{
c.drawColor(Color.RED);
}
Log.v(TAG,In onDraw);
c.drawText(hello , 100, 100, p);
insert();
}
public void insert()
{
if(flag)
{
flag=false;
}
else
{
flag=true;
}
 Log.v(TAG,In hello method);
 try {
Thread.sleep(250);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 invalidate();

}
public boolean onKeyDown(int keycode ,KeyEvent ke)
{

if(keycode==KeyEvent.KEYCODE_DPAD_CENTER)
{
Log.v(TAG,In KEY PRESS EVENT);
}
return false;
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] problem with Could not find helloAndroid.apk!

2009-02-18 Thread gganesh

hi ,
I'm using Ubuntu with Eclispe 3.4 and Android SDK 1.0 and sun-java 1.6
my keytool is pointing to java.1.6/bin/keytool
when i launch my application i get an error like


[2009-02-18 17:25:16 - hello] Android Launch!
[2009-02-18 17:25:16 - hello] adb is running normally.
[2009-02-18 17:25:16 - hello] Could not find hello.apk!

please help me to understand the problem

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---