[android-developers] SMS intent does not fill in number

2009-09-17 Thread Gustav Mauer

I want to send an SMS from an application, but without needing the SMS
permission, using an intent. This way the user can also decide if he/
she really wants to proceed to send the SMS. The code looks as
follows:

Uri smsToUri = Uri.parse(smsto:123456);
Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri);
sendIntent.putExtra(sms_body, Hello dear world);
sendIntent.setType(vnd.android-dir/mms-sms);
startActivity(sendIntent);

However, when the SMS screen now shows, the number is not filled in.
The SMS body is however filled in. This happens on the emulator and on
a phone. What am I doing wrong please?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SMS intent does not fill in number

2009-09-17 Thread Gustav Mauer

Thank you very much. That works great.

On Sep 17, 5:28 pm, Jack Ha jack...@t-mobile.com wrote:
 Try:

     sendIntent.putExtra(address, 123456);

 --
 Jack Ha
 Open Source Development Center
 ・T・ ・ ・Mobile・ stick together
 The coverage you need at the price you want

 The views, opinions and statements in this email are those of
 the author solely in their individual capacity, and do not
 necessarily represent those of T-Mobile USA, Inc.

 On Sep 17, 4:33 am, Gustav Mauer gus...@mauer.co.za wrote:

  I want to send an SMS from an application, but without needing the SMS
  permission, using an intent. This way the user can also decide if he/
  she really wants to proceed to send the SMS. The code looks as
  follows:

  Uri smsToUri = Uri.parse(smsto:123456);
  Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri);
  sendIntent.putExtra(sms_body, Hello dear world);
  sendIntent.setType(vnd.android-dir/mms-sms);
  startActivity(sendIntent);

  However, when the SMS screen now shows, the number is not filled in.
  The SMS body is however filled in. This happens on the emulator and on
  a phone. What am I doing wrong please?


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



[android-developers] Re: Recommended uses of a class extending android.app.Application

2009-09-12 Thread Gustav Mauer

I store my application config data in preferences:
http://developer.android.com/guide/topics/data/data-storage.html#pref
And have a singleton class to read and write (aka wrap) them. That way
it is also maintained even if the application is killed.

On Sep 11, 8:21 pm, Tom Gibara m...@tomgibara.com wrote:
 I hesitate to raise a word against any of Dianne's advice (ever) - and it
 clearly depends on the nature of your application. But what I find with my
 code is that most of the global state I want to keep depends on a Context.
 For example, anything that loads resources, or anything that needs to
 generate user readable messages.
 As a consequence I end up with a number of 'helper' classes that hold a
 reference to a context so that they can do their work. I find that the
 Application instance is the obvious context for these helpers.

 Furthermore, a specialization of the Application class seems the natural
 place for application code to access these objects, since the Application
 can instantiate them with itself (eagerly in onCreate or lazily behind
 accessors).

 Tom

 2009/9/11 Dianne Hackborn hack...@android.com

  On Fri, Sep 11, 2009 at 8:10 AM, Mark Murphy mmur...@commonsware.comwrote:

  The four main options I have used are:

  1. Custom application class, like you are proposing

  2. Static data (e.g., singleton class instance holding your configuration)

  3. A service

  4. Shared preferences

  Best is somewhat subjective -- I certainly do not have a definitive
  always use X recommendation.

  There isn't a best, it's very much dependent on what semantics you want --
  shared preferences will remain after the process is gone, a service's state
  is tied to the process but tells the system to try to keep the process
  around, and Application and static data are tied directly to the lifetime of
  the process and allow the system to remove them without guilt when the
  process isn't in active use.  (So Application and static are redundant, and
  static data lets you better modularize your code instead of stuffing
  everything in to Application, which is why I recommend statics.)

  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com

  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see and
  answer them.


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



[android-developers] Re: code for simple client server http communication

2009-08-29 Thread Gustav Mauer

Search the internet for the following string:
android HttpClient httpclient = new DefaultHttpClient();
This should give you a lot of examples.

On Aug 29, 7:00 am, ragavendran s sraghav.ra...@gmail.com wrote:
 I am new to android development

 can u give anybody .code for simple client server http communication

 i dont know how these client interact with server

 can u tel me the steps for this network concept...how we send the url
 connection to the serve.

 pls.

 thanks,

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



[android-developers] Re: Automatic launch of Virtual Keypad in first screen(launcher) of application

2009-08-29 Thread Gustav Mauer

What I did in the same situation was make one of the images in the
screen focusable (a property in the layout) and then when creating the
view in onCreate after the setContentView() call, called code like
this:
displayIcon = (ImageView)findViewById(R.id.your_image_widget);
displayIcon.requestFocus();
Then the keyboard does not show. Probably not perfect, but it worked
for me on the HTC Magic (G2).

On Aug 27, 8:17 pm, Muha muhamadsu...@gmail.com wrote:
     Hi Durg,
     I'm facing an opposite problem when the app is installed in a real
 device (a HTC G2). I want to open my screen with keypad hidden, but as
 the activity has an EditText which automatically receives focus, it
 triggers the opening of the keypad. As you did, I tried to put a
 similar code (see below) in onCreate() and onResume(), and tried also
 to send the focus to another view, but I didn't have success. On
 emulator, everything runs fine.

 InputMethodManager imm = (InputMethodManager) getSystemService
 (Context.INPUT_METHOD_SERVICE);
 imm.hideSoftInputFromWindow(meuEditText.getWindowToken(), 0);

     Maybe my problem can solve your problem.

 Regards,
 Muha

 On Jul 23, 10:09 am, Durg durga.n.pra...@gmail.com wrote:

  Automatic launch of VirtualKeypadin first screen(launcher) of
  application

  Hi All,

  I have created an application with a EditText in first screen
  (launcher). I want to launch this screen always with VirtualKeypad
  Open. I know how to launch thekeypadon focus change or click. I have
  tried the following code..

  InputMethodManager inputManager = (InputMethodManager) getSystemService
  (Context.INPUT_METHOD_SERVICE);
  inputManager.showSoftInput(objEditText,
  InputMethodManager.SHOW_FORCED);

  in onCreate(), onPostCreate(), onStart(), onResume() and onPostResume
  ().

  But still virtualkeypadis not coming up. Please help me if there is
  any API or Callback to call this function.

  Thanks in advance.

  Regards,
  Durg.


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



[android-developers] Re: Click on Status bar notification switch to task in current state?

2009-08-18 Thread Gustav Mauer

Marco wrote:
- You may be able to do what you want by having the notification start
a
- 'dummy' activity, which in turn brings your real activity to the
- front.

Marco, do you maybe please have sample code or something that show how
one can restore a task like that, hopefully keeping the activity stack
intact so that things like the back button behaves as the user would
expect?

Rick, yes, I also considered an empty intent, but for me that seems to
miss the point of the ability of the user to click on the
notification. I have built in some code to try to defend the
application against crashes,  but like in your case, sometimes the
activity stack is so messed up that a crash in inevitable.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Click on Status bar notification switch to task in current state?

2009-08-18 Thread Gustav Mauer

I have changed the intent to be as you have suggested, if I understand
correctly. I have also tried with and without singleTask in the
manifest for the launcher activity. With singleTask works a bit
better, but control still goes back to the AppStart activity when
clicking the notification, even through that is not where I was when I
pressed home.

My current code is:

activity android:name=.AppStart
  android:label=@string/app_name
android:launchMode=singleTask
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity



private void statusbarNotification() {
PendingIntent contentIntent = PendingIntent.getActivity(context,
0,
new Intent(Intent.ACTION_MAIN, null, context, 
AppStart.class)
.addCategory(Intent.CATEGORY_LAUNCHER)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
0);

String text = Notification message;

final Notification notification = new Notification(
R.drawable.icontabbar,
text,
System.currentTimeMillis());

notification.setLatestEventInfo(
context,
Heading,
text,
contentIntent);

notification.defaults = Notification.FLAG_AUTO_CANCEL +
Notification.FLAG_ONLY_ALERT_ONCE;

nm.notify(NOTIFICATION_STATUS_ID, notification);
}

Any ideas please on what I need to change?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Click on Status bar notification switch to task in current state?

2009-08-16 Thread Gustav Mauer

My applications carries on processing when the user presses the home 
key, and generates status bar notifications if something happens the 
user requested to be notified about.

If a user holds the home key and then selects the application, it is 
restored in its correct state with the activity on top that showed when 
the user left.

However, since the intent that is associated with the status bar 
notification is FLAG_ACTIVITY_NEW_TASK and I put in the class name of 
the activity that launched the application (I assume this is what I must 
do?), the launcher activity is started when the notification is 
clicked. I can then switch the application back to the current 
activity by starting that active activity again, but then I seem to 
have two instances of the activity in memory, since I have to press back 
twice to leave it. And I suspect my activity stack is then messed up as 
well.

I have set the launcher activity to be singleTask, but that only helped 
a bit. From my reading I thought this would just give the task focus if 
the launcher activity is not on top, but instead it gives the launcher 
activity the focus.

Is there a way for a notification click to work more like the task 
switcher provided by long pressing the home button? Thank you in advance 
for any advice.

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