i wrote a custom syncadapter, which also added a custom field to the rawcontacts. Exactly how it is done in the SampleSyncAdapter or in this example with the last.fm-App. And it is working fine on the emulator.
The xml-file, which declares my custom field:
<ContactsSource xmlns:android="http://schemas.android.com/apk/res/android">
<ContactsDataKind
android:mimeType="vnd.com.google.cursor.item/vnd.alien.mimetype"
android:icon="#drawable/icon"
android:summaryColumn="data2"
android:detailColumn="data3"
android:detailSocialSummary="true" />
</ContactsSource>
The code to add the custom field to the data-table of the contactscontract-provider:
mContentUri = Data.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build();
Builder mID = ContentProviderOperation.newInsert(mContentUri)
.withValue(Data.RAW_CONTACT_ID, getRawContactId())
.withValue(Data.MIMETYPE, "vnd.com.google.cursor.item/vnd.alien.mimetype")
.withValue(Data.DATA1, mContactInformations.get("mID"))
.withValue(Data.DATA2, mContext.getString(R.string.profile_text))
.withValue(Data.DATA3, mContext.getString(R.string.profile_id)+" "+mContactInformations.get("mID"));
But when I run them on my HTC Desire with HTC Sense installed, I can't see this custom field anymore?!? Has anyone experienced the same problem?
Any hint to get my custom field visible is highly appreciated!
Cheers Ali3n
The default contact viewers do not show custom fields.
There are some 3rd party apps that do show custom fields, a free one (but ad supported) is here
Unfortunately I did not found a real solution for that. But two things reduce the problem:
This problem did only appear on my old HTC Desire. On my sisters HTC Sensation the custom-field shows up as expected (nice fail from HTC in the first try oO)
Even better is, that the intent that would be started via this custom-field also shows up in the QuickContactBadge, which is used by the native HTC Contacts-App even on my HTC Desires Sense. Therefore the user can invoke my activity via the QuickContactBadge on old Senses versions and in new versions he also has the ability to use the custom-field.
Related
I develop an Android app. If I call
float.Parse("51.552058")
in Editor or App on my Mac Book (Language Setting English), it works fine. After publishing to Android (Language Setting German) the result of the Parse operation is not "51.552058" anymore but "5,155211E+09". I understand that this might be related to the device's language but I still don't really understand what is happening and why.
I also tried following with no success:
float.Parse("51.552058", System.Globalization.NumberStyles.Any)
float.Parse("51.552058", System.Globalization.NumberStyles.AllowDecimalPoint)
Did anyone stumble over this before?
float.Parse is culture dependent.
See e.g. from NumberFormatInfo
// '1,034,562.91' --> 1034562.91 (en-US)
// '1,034,562.91': FormatException (fr-FR)
// '1,034,562.91' --> 1034562.91 (Invariant)
Reason here is that in EU cultures the , is usually the decimal separator while the . is used as the group separator. So from the example above the correct format for fr-FR would be 1.034.562,91
You probably rather want to use CultureInfo.InvariantCulture like
float.Parse("51.552058", CultureInfo.InvariantCulture);
or directly NumberFormatInfo.InvariantInfo
float.Parse("51.552058", NumberFormatInfo.InvariantInfo);
which simply has defined
NumberDecimalSeparator .
NumberGroupSeparator ,
I am trying to modify my existing contacts on my device.
I have implemented all the related stuff (AuthenticationService, AbstractThreadedSyncAdapter, SyncService, AbstractAccountAuthenticator etc..) following this guides/examples and this.
All works fine on my Samsung Galaxy S7 that has Android 7: now my contacts have a new custom function, if I select it, an Activity of my Application is launched. This is accomplished creating a contacts.xml file and using a custom MIMETYPE (as explained in the links above).
Unfortunately this approach seems to not work on devices running Android with version < 7. My custom function is not shown although everything seems to work correctly and no error is detected.
If someone knew something concerning it, it would be a great help.
Thanks in advance.
I'm assuming the ";" in your contacts.xml is a typo, or your project wouldn't compile
Try removing the android:detailSocialSummary line from your contacts.xml as most examples I know don't have that
Instead of ContactsAccountType try ContactsSource, see this as reference.
The mimetype usually doesn't point to an activity within your app, it should be: vnd.android.cursor.item/vnd.<your package>.<some action> but I don't think that's the problem you're having
Check Mime Type line, you must have to add .profile at the end and /vnd..profile
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource
xmlns:android="http://schemas.android.com/apk/res/android">
<ContactsDataKind
android:mimeType="vnd.android.cursor.item/vnd.com.krishna.test.profile"
android:icon="#mipmap/ic_launcher"
android:summaryColumn="data2"
android:detailColumn="data3" />
</ContactsSource>
I was trying to make something in Adobe Flash, Air for android. I simply made a square and converted it to an Symbol (called 'hello') and I entered this code.
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
hello.addEventListener(TouchEvent.TOUCH_TAP, tap);
function tap(event:TouchEvent):void
{
hello.x+=15;
}
but nothing happend. I even used CODE SNIPPERS, and also tested this on my phone(ALCATEL onetouch idol mini), and it also said that there are no errors.What have I done wrong?
You set everything correctly but forget only one important thing: check if the system supports touchevent.
if(Multitouch.supportsTouchEvent)
I am developing an app that targets for tablets only not for phones.
Is this code is enough to acheive my goal? Is there any way to test it or google play sorts it's by itself and present to users?
Below is the code I have tried. But I don't know how to test it?
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<supports-screens
android:largeScreens="true"
android:normalScreens="false"
android:smallScreens="false"
android:requiresSmallestWidthDp="600"
android:xlargeScreens="true" />
Is android:anyDensity="true" should be given along with support screen tag? Or just leave that attribute. I want to work my application on all range of tablets.
Any help in this case is highly appreciable. Thanks in advance.
Seems oke, should work as far as I know.
Think about what you define as a tablet. What makes your app less suitable for a 6" phone, than for a 7" tablet?
You can't really test this until you upload it in the Google play Store. These filters in the manifest.xml are used by the Google Play Store, not actually when installing an app. They just make sure somebody doesn't find the app on his tablet and the install button won't work on the website.
You could test it by just uploading your APK but not publishing I think. It will give you a list of devices that are supported with the current settings.
whatever you given that is correct u have to test it on tablets it will load and for mobile phones it will not launch.
and go into the android market publisher page.
1.Make sure your app is uploaded.
2.Click on your app name.
3.Scroll down to where it says 'Show devices'.
4.Click that and you can exclude all mobile phones from downloading your app.
Failing that you can set some parameters in your manifest for screen size etc, but this is less reliable.
You can use a trick here...
1) Create an startup activity, which only verifies screen size in its on create an starts actual activity in success scenario. like,
// In onCreate of startup activity
if (isTablet()) {
startActivity(new Intent(StartupActivity.this, MainActivity.class));
this.finish(); // don't forget to kill startup activity after starting main activity.
} else {
setContentView(R.layout.startup);
}
This is the critical point. In else case you should set layout to this activity which ideally can have a label with you message like "Device not supported." and a button to close application.
2) Ideally, you should place all your string resources in res/values-large/strings.xml if you want to support only tablets. So here is the trick, Just add following item in your string resources...
<string name="is_supported_screen">true</string>
And now create a new string resource file at res/values/strings.xml which will contain the same string item but with false value like...
<string name="is_supported_screen">false</string>
NOTE: make sure this string resource file must contain atleast all the resources used in StarupActivity e.g. activity title, device not supported message, close app button text etc.
3) Finally write a method in your StartupActivity like,
private boolean isTablet() {
if (Boolean.parseBoolean(context.getResources().getString(R.string.is_supported_screen))) {
return true;
} else {
return false;
}
}
And its done...:)
Actually what happens here is, for devices with large screens like tablets, will load string resource from res/values-large/strings.xml and will found true and in the case of other device, android will load resources from res/values/strings.xml and it will found false int the method isTablet() for value of R.string.is_supported_screen.
And finally, Your main activity will be started if app is installed in tablet and will show message of device not supported will be displayed.
I would like to emphasize that this is a trick, so you need to follow all the steps carefully. Any mistake and you will not get desired results.
I have installed
Flash Builder Burrito
Sdk 4.5
and
Flash Player 10.2
Air 2.0
but there is not needsSoftKeyboard() method in my view
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Home" xmlns:views="views.*"
destructionPolicy="none" xmlns:mx="library://ns.adobe.com/flex/mx" >
and this is NOT in
<s:TextInput x="194" y="212" />
I have read about this method and about SoftKeyboardEvent but i could not access softkeyboard method and SoftKeyboardEvent as well.
What is the reason?
May be i am missing something.
Please help me.
I am making a Flex Mobile Project in which user can add text at run time.
How can i open soft keyboard to add text at run time.
Thanks.
What control (not the View) are you trying to set this on? From the documentation, it is not a method, but a property on a control. It is not needed on TextInput because it comes up automatically (and can't be made to false):
http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9a274c00-8000.html
For instance, NumericStepper might benefit from needsSoftKeyboard.
There are also three soft keyboard events on the controls:
softKeyboardActivate, softKeyboardActivating, softKeyboardDeactivate
More info here:
http://help.adobe.com/en_US/as3/dev/WSfffb011ac560372f6bc38fcc12e0166e73b-8000.html