Inserting note into already installed calender application on android phone - java

I want to create an application which will have:
a text field that will take input from the user, and
a button, which, when clicked, will open a calendar application that is already available in the phone; then, the input text will be added as a note to the selected date.
How can this be done? Is it even possible to do this? If not, how can I display a calendar in my application? I guess this may be a layman's question, but I have just started up with Android programming. Also, I am planning to make the app using HTML, CSS and Javascript. Is it ok to go with it? or is it easier to use only Java and XML files?

I don't know about Calendar application. Here is an example how to start Dropbox app:
Intent intent = getPackageManager().getLaunchIntentForPackage("com.dropbox.android");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
try
{
startActivity(intent);
}
catch (Exception ex)
{
}
You should do something similar for Calendar. Maybe you can provide additional params to intent to make your note insterted into specific date.

Go with Java and XML which i prefer, And about HTML,CSS and Javascripte you can use these if you are developing app using Phonegap.
About your application you can have customize calendar in android you can find many example.

Related

Offline SpeechRecognizer on Android is not working

I am working with SpeechRecognizer. The problem was if there is no active internet connection SpeechRecognizer will throw error SpeechRecognizer.ERROR_NETWORK or SpeechRecognizer.ERROR_SERVER.
This is my RecognizerIntent
final Intent recognizerIntent;
recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, this.getPackageName());
recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
recognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
And I put recognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
But no luck. again it will throw the same error.
And I got these 2 errors frequently.
SpeechRecognizer.ERROR_RECOGNIZER_BUSY
SpeechRecognizer.ERROR_NO_MATCH
Please help me.
First of all, you need to make sure if you have offline package of language you put to EXTRA_LANGUAGE_PREFERENCE installed on the device.
To enable Offline Speech input in supported devices, follow below steps:
Go to Settings
Click on “Language and input”
On-screen keyboard
Select Google voice typing
Select Offline speech recognition
Install desired language
If it still does not work offline, try to change your EXTRA_LANGUAGE_PREFERENCE value to something more specific, "en-US" for example (That did the trick for me)
And also, if you want to tell SpeechRecognizer wich language it should recognize, I guess you should use EXTRA_LANGUAGE parameter instead of EXTRA_LANGUAGE_PREFERENCE
Hope it will help

How Can I Implement Google Voice Typing In My Application?

I am trying to add a button in my application that starts Google Voice Typing (or the default speech recognition). I have tried following this tutorial. This tutorial is incredibly confusing to me. I imported the .jar, and added the necessary permissions, services, and activities to my Manifest. But I can't seem to figure out how to "put it all together". I'm wondering:
Am I supposed to call the inputMethodService from my button click in my Main Activity? Or does my inputMethodService essentially become my Main Activity?
What does IME mean? I tried to Google it, but the definitions it gave me didn't help my understanding.
When I try to copy and paste the whole DemoInputMethodService code into my current activity, I get an error saying I cannot extend InputMethodService inside of this activity. (Which leads back to to ask question one.)
How can I get this to work?
If you want to follow the tutorial that you mention then you need to implement an IME (input method editor) first, see http://developer.android.com/guide/topics/text/creating-input-method.html
This IME can have a regular keyboard look-and-feel or contain just a microphone button.
The user of your app will first have to click on a text field to launch the IME. (Note that there can be several IMEs installed on the device and they have to be explicitly enabled in the Settings.) Then the user will have to click on the microphone button to trigger the speech recognition.
The tutorial provides a jar that lets you directly call Google's recognizer. It would be nicer if instead you called the recognizer via the SpeechRecognizer-interface (http://developer.android.com/reference/android/speech/SpeechRecognizer.html), this way the user can decide whether to use Google's or something else.
The SpeechRecognizer is given a listener which supports the method onPartialResults, which allows you to monitor the recognition hypotheses while the user is speaking. It's up to you how you display them. Note however that the specification of SpeechRecognizer does not promise that this method gets called. This depends on the implementation of the recognizer service. Regarding Google's implementation: what it supports keeps changing unannounced, it does not have a public API nor even release notes.
You might be able to reuse my project Kõnele (http://kaljurand.github.io/K6nele/about/), which contains two implementations of SpeechRecognizer and an IME that uses them. One of the implementations offers continuous recognition of arbitrarily long audio input, using the Kaldi GStreamer server (https://github.com/alumae/kaldi-gstreamer-server). You would need to set up your own instance of the server porting it to the language that you want to recognize (unless you want to use the Estonian server that Kõnele uses by default).
Voice recognition samples are found where you have the android SDK..
example:
$ find $SDK_ROOT/samples -name *recogni*
./android-19/legacy/VoiceRecognitionService/res/xml/recognizer.xml
./android-19/legacy/VoiceRecognitionService/src/com/example/android/voicerecognitionservice
./android-19/legacy/ApiDemos/res/layout/voice_recognition.xml
./android-18/legacy/VoiceRecognitionService/res/xml/recognizer.xml
./android-18/legacy/VoiceRecognitionService/src/com/example/android/voicerecognitionservice
./android-18/legacy/ApiDemos/res/layout/voice_recognition.xml
./android-21/legacy/VoiceRecognitionService/res/xml/recognizer.xml
./android-21/legacy/VoiceRecognitionService/src/com/example/android/voicerecognitionservice
./android-21/legacy/ApiDemos/res/layout/voice_recognition.xml
any one of the services should help show how to do a RecognizerIntent
The "APIDemo" seems to include use of a RecognizerIntent. check the source for that one. Otherwise look into the services and carve them up into an intent.
I had the same issue, but after a long time looking for continuous voice dictation on an activity, I solved that problem using pocketsphinx.
I couldn't find the way to integrate Google Voice Typing on an activity, just on an input method by following that tutorial. If it confuse you, just download this demo and modify it.
Good Luck!
You can trigger an intent from a button listener
Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
And the result can be get from
private TextToSpeech mTts;
protected void onActivityResult(
int requestCode, int resultCode, Intent data) {
if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
// success, create the TTS instance
mTts = new TextToSpeech(this, this);
} else {
// missing data, install it
Intent installIntent = new Intent();
installIntent.setAction(
TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
}
}
}
Refer this link for more info.

How can I have a view controller open only on the first launch

I have built a simple app with Xcode 5, using very basic functions. As my app is going to have a large target audience, I want it to support different languages. I have done the translation part, but what I want is a view controller which displays language selection only the first time the app is opened. I am new to developing apps, so please explain me in detail. Thanks in advance.
Use NSUserDefaults to store data between app launches. You will need something like:
static NSString * const kShowIntroductionKey = #"ShowIntroductionKey";
- (void)showOnFirstLaunch
{
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
BOOL wasIntroductionShowed = [userDefaults boolForKey:kShowIntroductionKey];
if (!wasIntroductionShowed){
// Show your screen here!
[userDefaults setBool:YES forKey:kShowIntroductionKey];
[userDefaults synchronize];
}
}
Also may be it will be better to use native iOS localization mechanism.

Android: custom Facebook integration

I need some advice for this matter...
I used the facebook android sdk to create an integration with facebook from my application...I followed this tutorial:
http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/
I would need to implement authentication in one activity and the function postToWall in another.... after authentication i want to send post simply by pressing a button but in other activity, different from that where i do authentication.
is it possible? or with the SDK I'm forced to do everything together in the same activity?
thanks in advance
Yes it is possible. You will get a access token which you can send to the next activity. Use getAccessToken() and setAccessToken().
Here is an example that even saves the needed data: Contact-Picture-Sync
you need to install an extension, similar to the core Android SDK, but no, here is what you need to do:
1.) go to github.com/facebook/facebook-android-sdk
2.) download the facebook directory ONLY! The other directories are only examples.
3.) Put the files from the src (you can copy the drawables too, if you want to) in the package, you are currently working with
4.) You are good to go, you can use the facebook "SDK"
see also this example https://github.com/facebook/facebook-android-sdk/tree/master/examples/Hackbook download it , it is working example provided by facebook
just to provide an alternative answer, there's other ways of implementing sharing on Android.
It allows for more sharing options (like Twitter, QR-Barcodes, blogging and whatnot) without having to deal with the facebook android sdk.
What you would use is a "share" intent, like so:
String title = "My thing"; // used if you share through email or channels that require a headline for the content, always include this or some apps might not parse the content right
String wallPost = "Hey - check out this stuff: http://link.com "; // the content of your wallpost
String shareVia = "Share this stuff via"; // the headline for your chooser, where the phones avaliable sharing mechanisms are offered.
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, title);
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, wallPost);
startActivity(Intent.createChooser(shareIntent, shareVia));
This is by far the preferred solution on Android if you're looking for simple sharing, as it makes your app future-compatible with new services. And more lean and flexible for the user too, as there's little to no friction from hitting the share button to posting content.
It can also be seen in this blog post: http://android-developers.blogspot.com/2012/02/share-with-intents.html
I hope you can use this for your project.

Sharing list field item via email in blackberry

I am developing an application in blackberry.The application has got list field items.So when i click any list-field item,it should open the default email client of the device,so that the person can share that item.Can anyone provide sample code for sharing item via email in blackberry?
It's pretty easy, actually. Call the Invoke.invokeApplication method, as shown in this example:
http://docs.blackberry.com/en/developers/deliverables/11935/Invoke_BB_device_software_app_565421_11.jsp
You can use this to make phone calls, open the calendar, etc.

Categories

Resources