Tag Archives: android

Lync 2013 Android Client – Version of Lync has been blocked error

Symptom: When logging into the Lync 2013 on an Android or iOS device, you receive the following error:

This version of Lync has been blocked by your system administrator.  Please check for updates or contact your Lync support team.

Lync 2013 Mobile Version

 

Solution: This error is caused by not running the latest version of Lync Server 2013.  Make sure you have at least the February Cumulative Update 1 patch applied to your server.  Without this patch, the Lync client will not be able to login.

You can grab a copy of the patch from: http://www.microsoft.com/en-us/download/details.aspx?id=36820

Details on how to install the patch can be found here: http://support.microsoft.com/kb/2809243

How to pass parameters back from intent

Tonight I ran across the issue of, “How do I send a result back to the parent that spawned an intent?”

After finding out that it is nearly impossible to pass instances of objects to the intent, I decided why not send the result back from the spawned intent.

To do something like this, use the following code to spawn the child intent:

//Starting a new Intent
Intent intent = new Intent(getApplicationContext(), whateverClass.class);

// Maybe add a param or two?
intent.putExtra("someParam", paramValue);

// starting new activity
startActivityForResult(intent,SOMEINTEGERSHOULDGOHERE);

When you are done with the intent, use this code to close it.

Intent intent=new Intent();
intent.putExtra("myParam", thiscouldbeastringvariable);
intent.putExtra("mySecondParam", thiscouldbeanintvaraible);
setResult(RESULT_OK, intent);
finish();

Lastly, here is how we process our result given from the child:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case (SOMEINTEGERSHOULDGOHERE): // this was the integer you used to spawn the activity previously
if (resultCode == Activity.RESULT_OK) {
// Do whatever you want here.
// data.getStringExtra("ThisGetsOurParamBack");
}
break;
}
}

This is basically how to send data, process it in a new activity/intent, and then spit the results back to the parent.

How to make textview stay visible with softkeyboard

If you have a textview that spans a few lines, but have buttons or something else below the textview that you would like to be shown, you can have the textview object be resized automatically to make room for Android’s softkeyboard. To do this, simply add one line to your AndroidManifest.xml file.

android:windowSoftInputMode="adjustResize"

This line of code should go inside of the

<activity
android:name="SomeActivityName"
android:windowSoftInputMode="adjustResize" >
</activity>

How to link text in Android

One of the weirdest things I stumbled across was the ability to hyperlink text in the Android environment.  Here is how to hyperlink text and then make it clickable.

TextView txtTheLink = (TextView)findViewById(R.id.txtTheLink); // Grab our textview/whatever with the HTML
txtTheLink.setText(Html.fromHtml("<a href=\"https://www.vooba.net\">Go to Vooba!</a>")); // Convert from HTML to remove the HTML tag>
txtLinks.setMovementMethod(LinkMovementMethod.getInstance()); // Activate the link

Hope this helps!

Permission to enable read/write access to SD card

If you are looking for the permission to add to your AndroidManifest file, you are looking for the WRITE_EXTERNAL_STORAGE setting. To do this programmatically, use this code:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

How to get default preferences

You can get the default preferences from your preferences.xml file by using the following code:

// Get the xml/preferences.xml preferences
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String settingValue = preferences.getString("setting", "");

PHP Arrays in JAVA

Going from PHP to Java is a step backwards when dealing with arrays (imo).  One of the more beneficial things that you can do with a PHP array is define keys.  For example I can do something like:

$myList = array("oranges"=>15, "apples"=>25);

Then I can access how many oranges I have by going echo $myList[“oranges”];

To do something like this in JAVA is a bit different than just defining a normal array. In JAVA you need to use a Map:

HashMap myList = new HashMap();
myList.put("oranges", 15);
myList.put("apples", 25);

If you need to store two strings, then change the object type (I.e. HashMap).
To get the value, simply use the get method.

myList.get("oranges");

How to get the version name from the AndroidManifest.xml file

Use the following code snip in your application:

try
{
    String VersionName = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
}
catch (NameNotFoundException e)
{
    Log.v(tag, e.getMessage());
}

How to scroll a workspace/activity/layout

You need to add the ScrollView FrameLayout.  A great example on how to do this can be found here:

http://android-pro.blogspot.com/2010/02/android-scrollview.html