How to know the caller of ContentProvider

by James Wang » Thu, 17 Dec 2009 18:31:27 GMT


Sponsored Links
 We are developing a ContentProvider which is supposed to serve for
specified packages. So we want to get the caller package name. Is
there any way to achieve that?

Thanks in advanced.

James

--



How to know the caller of ContentProvider

by James Wang » Fri, 18 Dec 2009 09:12:50 GMT


 We got a solution here:
int pid = Binder.getCallingPid();

And pass the pid to getProcessNameFromPid below:

private String getProcessNameFromPid(int givenPid) {
ActivityManager am = (ActivityManager)
getContext().getSystemService(Activity.ACTIVITY_SERVICE);

List<ActivityManager.RunningAppProcessInfo> lstAppInfo =
am.getRunningAppProcesses();

for(ActivityManager.RunningAppProcessInfo ai : lstAppInfo) {
if (ai.pid == givenPid) {

return ai.processName;
}
}
return null;
}

I wonder whether there is any other way to do it.

--


Sponsored Links


Other Threads

1. Screen Orientation in Android

Hi All..

Im facing some problems on Screen Orientation in android.
In my application one screen contains Name,Age(as EditTexts). When i
click on Name EditText internal Keypad is opening and some of the
buttons are hiding due to that keypad.

I have some questions regarding this.
1) Whether i need to shrink the application screen as per the keypad
layout??
2) How much space the keypad will occupy??
3) How to change from Portrait mode to landscape mode dynamically??

So Please help me to resolve the issue.

Any help greatly appreciated...

Thanks in advance

-- 

2. CSS support on WebView

Hello All,

I have a requirement of using a WebView to display the jsp pages from
the server which uses JSTL. Here we have buttons in tabular form
displayed using <table> tag and the first button needs to shown as
selected with the CSS enabled for that selection. The buttons here are
simple input type button with in an anchor tag to navigate to other
pages

<a onmouseover="focusOnMouseOutOnHover(${status.index})"
onmouseout="focusOnMouseOut('abc_0','btn');" id="abc_${status.index}"
class="btn" href="abcd.jsp?cid=${abc.id}"><input type="button"
name="abButton_${status.index}" value="${name}" title="$
{fn:escapeXml(abc.name)}" class="flex-btn"></a>

but the problem is that on device the default focus is not always on
the first button and after that the trackball scrolling is also not
definite. It sometimes scrolls properly and sometimes does not scroll
at all through all the elements in the page. We need the focus on the
first button always when ever we navigate to the page either first
time or through the back key. At present we are calling a javascript
function on onLoad of the <body> to set the focus on the first button
and then update the CSS class also to show it as focussed and
selected.

We have lots of CSS applied on the page to get the rich look of the
Android client on these pages.

Please let me know if there is some solution for this. Is it the
problem of CSS being applied or WebView is not able to support the CSS?

-- 

3. Tampilan 3d home untuk android

4. ROM Eclair Magic

5. Example that prints 1 2 3 4 on A A A A?

6. programatically press a button

7. Popping up a custom Dialog from a Widget (AppWidget)