0

friends, I need to develop a keyboard which should have an icon of the app which invokes the softkeyboard.

I found a link which might be useful is here How does an Android app load a keyboard?

So how can i get to know which is invoking the keyboard ? or the package name of foreground activity ? Does anybody have any idea, i appreciate and very grateful to them.

Thank You

Community
  • 1
  • 1
Charan Pai
  • 2,288
  • 5
  • 32
  • 44
  • this Question ans can be used as solution http://stackoverflow.com/questions/13620037/how-can-i-get-the-package-name-of-2nd-top-activity-which-is-in-other-package – Charan Pai Dec 12 '12 at 11:38

2 Answers2

0

Have you tried getting ApplicationInfo from the context object. Check out this link for java doc.

ApplicationInfo Super class is PackageItemInfo which has a field called PackageName. This might help you.

You can use the package manager getApplicationIcon() method to get the Drawable for the application icon by passing the ApplicaiotnInfo object to this method...

Edit1:

You can also use context class getPackageName() method to get the name of the application package. Once you have the package name then you can use PackageManager getApplicationIcon(String packageName) method to get the icon.

Praful Bhatnagar
  • 7,425
  • 2
  • 36
  • 44
0

this Question ans can be used as solution how can i get the package name of 2nd top activity which is in other package?

Get the top activity running is the activity which starting the keyboard, little hacking way but still working :)

Community
  • 1
  • 1
Charan Pai
  • 2,288
  • 5
  • 32
  • 44