Categories
discuss

How to determine the current IME in Android?

I have an application where I would like to warn the user if they are not using the default Android softkeyboard. (i.e. they are using Swype or some thing else).

How can I check which input method they currently have selected?

Answer

You can get a default IME, use:

Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
Categories
discuss

How can I lock files in android using java code?

I want to lock files that is on the sdcard of android.
I need to lock them so no one except my software can delete copy move or send them over bluetooth or any other way.
How can I do it?

Answer

I think you want to encrypt the file. While the file can still be moved around, it will be useless to anything but your application. People will be able to copy, move, delete but the contents won’t be compromised.

Categories
discuss

Which work process in my company should I Improve first?

I’ve just started to work in a new place, and I see several things they do that I find really terrible, and I want to know if they are indeed so wrong, or I am just too strict. Please let me know if my criticism is in place, and your opinion on which problem is the worst and should be fixed first. The developement is all in Java.

  1. Not using svnignore. This means svn stat can’t be used, and developers forget to add files and break the build.

  2. Generated files go to same folders as committed files. Can’t use simple maven clean, have to find them one by one. Maven clean doesn’t remove all of them.

  3. Not fixing IDE analyze warnings. Analyze code returns about 5,000 warning, of many different kinds.

  4. Not following conventions: spring beans names sometimes start with uppercase and sometimes not, ant properties sometimes with underline and sometimes with dots delimiter, etc.

  5. Incremental build takes 6 minutes, even when nothing is changed.

  6. Developers only use remote debug, and don’t know how to run the Tomcat server internally from the IDE.

  7. Developers always restart the server after every compilation, instead of dynamically reloading the class and saving the server’s state. It takes them at least 10 minutes to start checking any change in the code.

  8. Developers only compile from command line. When there are compilation errors, they manually open the file and go the the problematic line.

  9. A complete mess in project dependencies. Over 200 open sources are depended on, and no one knows what is indeed needed and why. They do know that not all dependencies are necessary.

  10. Mixing Maven and Ant in a way that disables the benefits of both. In one case, even dependency checks are not done by Maven.

  11. Not using generics properly.

  12. Developers don’t use Subversion integration with IDE (Eclipse, Intellij Idea).

What do you think? Where should I start? Is any of the things I mentioned not really a problem?

Answer

I’d look at it like this:

  • Anything that affects productivity should be solved first
  • Things that affect profitability solved second (most productivity fixes are profitability fixes too)
  • Nitpicky stuff last

Therefore, you should have the following (in order of my opinion):

  1. 7 – Restarting the Server after Compilation
  2. 5 – Incremental Build Speed
  3. 6 – Remote Debugging only
  4. 8 – Compiling from command line
  5. 12 – Subversion Integration (kind of in the same league as 5. above)
  6. 2 – Generated Files
  7. 11 – Not using Generics Correctly

Then

  1. 1 – svnignore
  2. 9 – Project Dependencies (this will take a great deal of time i’m sure)
  3. 10 – Mixing Maven + Ant
  4. 3 – IDE Warnings
  5. 4 – Conventions

The reason I have the ordering in this sense is time vs. benefit. If it takes a user 16 minutes to compile and check their code, it’s bloody well insane to be honest. Say a developer compiles 5x per day, we’re taking about 80 minutes, doing nothing.

After that it’s productivity. If you speed up the rate at which your developers can do their work, the turnover of work completed will rise substantially. (Profitability++)

After this is the “nitpicky” things. I say this not as to infer that they’re not important, but the fact is from the looks of things you have much bigger fish to fry, so get those done first before correcting casing in code.

Categories
discuss

softkeyboard in landscape mode does not pop up in android emulator

In android emulator, I am in landscape mode and double click the text edit panel. the softkeyboard does not show up. However, it works in portrait mode.

I have check some of posts on line. They said because of hardkeyboard is available in landscape mode. If that so, how can i disable the hardkeyboard. Or is there any setting reason for this problem?

Answer

The default emulator has a hard keyboard. When you put it in landscape mode it doesn’t show the softkeyboard.

To solve this, create a new AVD and in Hardware properties add:

Keyboard support "no"
Categories
discuss

Unlock Key Component

I have almost completed my Android application so am considering ways of distributing the application. I have seen some applications on Market have free limited/locked version and separate Unlock Key/License Key which unlocks extra functionality.

How is this done? Has anyone here done this? If so, how well does it work?

I am thinking maybe this is better then having two versions of the same application (i.e Lite and Pro).

Thanks.

Answer

Done some more research and I found post by author of AppSwipe on how they solved this problem. The idea is to have static method that returns boolean value indicating whether the end user has key component installed or not. The check is done using PackageManager signature check.

More details

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..