Rakesh Jhamb

Ranch Hand
+ Follow
since Jun 18, 2003
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rakesh Jhamb

Hi Sahil,

I tried Smart Receiver Pro and found it very useful and easy to use.

Taskos was also nice.
12 years ago
as per my understanding, android 3.x is specifically for tablets, that is why it covers the whole screen. But you can still use function keys to move back and forth, plus the desktop keyboard to do the typing.
12 years ago

I have following code in BroadCastREceiver to start an Activity

This works fine and my activity does start, but it starts on top of my main activity (which is some other activity, for example B). What I want is that from my broadcast receiver I should be able start an Activity A, such that when I press back button from there, the control should not go to B Activity.

Please let me know what I am missing.
12 years ago
I have a ListActivity which is showing contacts from Contacts API. Inside listView I am showing contact photo in QuickContactBadge alongwith Contact Name.

I am using following code.

My problem is I want to control QuickContactBadge size in a way that it looks same on all different screens, i.e. is there a way to define size in dips.

Please let me know.
12 years ago
Here is my AndroidManifest.xml for your reference.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8"/>

<application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/robot">
<activity android:name=".MainActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<receiver android:name=".IncomingCallReceiver">
<action android:name="android.intent.action.PHONE_STATE"/>
<activity android:name="Prefs" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>

<activity android:name=".LookupContactsActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".ConfigureOneContactActivity" android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"></activity>

<supports-screens android:anyDensity="true" android:smallScreens="true"/>

12 years ago

I have developed a simple app using target sdk 8. But minSDKVersion is 3. I setup an emulator with Target SDK 1.5 (i.e. API Level 3). When my main activity starts it throws an exception while drawing view. Following is the exception.....

07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class java.lang.reflect.Constructor
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createView(LayoutInflater.java:512)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 11 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: java.lang.reflect.InvocationTargetException
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.widget.ImageView.<init>(ImageView.java:103)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at java.lang.reflect.Constructor.constructNative(Native Method)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.view.LayoutInflater.createView(LayoutInflater.java:499)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 24 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/title_bar_shadow.9.png from drawable resource ID #0x7f020001
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.Resources.loadDrawable(Resources.java:1641)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.widget.ImageView.<init>(ImageView.java:113)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 28 more
07-17 16:26:48.507: ERROR/AndroidRuntime(790): Caused by: java.io.FileNotFoundException: res/drawable/title_bar_shadow.9.png
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.AssetManager.openNonAssetNative(Native Method)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.AssetManager.openNonAsset(AssetManager.java:392)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): at android.content.res.Resources.loadDrawable(Resources.java:1634)
07-17 16:26:48.507: ERROR/AndroidRuntime(790): ... 30 more
07-17 16:26:48.797: INFO/Process(568): Sending signal. PID: 790 SIG: 3
07-17 16:26:48.797: INFO/dalvikvm(790): threadid=7: reacting to signal 3
07-17 16:26:48.827: INFO/dalvikvm(790): Wrote stack trace to '/data/anr/traces.txt'

The exception boils down to filenotfound... res/drawable/title_bar_shadow.9.png. What is this file. Is this a file not present in 1.5. I am not explicity referencing this file anywhere.

Please suggest what may be the cause of the problem.

12 years ago
I have a ListView which dynamically adds QuickContactBadge and a TextView to show contact names and their photo in QuickContactBadge. I am using the following code to show photo in QuickContactBadge...

Then i am calling this method by saying.
quickContactBadge.setImageBitmap(loadContactPhoto(getContentResolver(), contactId));

I have following problem

1) The image is getting displayed, but it is huge. how to control layout and size of quickcontactbadge. Sample code is appreciated.
2) Is this the best way to show image of a contact in quickContactBadge or if there is a preferred way, please let me know.

12 years ago
Thanks for your reply. I know about these links. I am more interested in some nice UI examples + how to do them.
12 years ago

I have programmed in Java for few years and I am able to develop appliation in android. One thing, I have not explored yet, is the user interface designing. What I wanted to know is how to get started to design a good user interface.\

Can we please use this post to collect few good URLs + books + other stuff that teach good user interface design practices + examples.

12 years ago
It is the same thing. Even with onCallStateChanged(), you can't tell when accept or decline button is clicked. For example, you won't be able to distinguish between missed calls and rejected calls for example.
12 years ago
No, this doesn't work.

Using these options, you cannot differentatite which button was clicked.

Someone else, has an idea.
12 years ago
Ok, here is the use case.

I have a preferences screen that has an option, which I click will list all the contacts.So this has to be done in an Activity I guess.

Also, in Google API Demos, there is an example that starts an activity from Preferences and that also declaratively using XML. The problem is, it is starting a browser that opens up www.android.com.

I want a declarative example how to declare intent tag that will be able to launch a normal Activity class.

Waiting for your response.

12 years ago

I have a PreferenceActivity Class that has the following code.

Using this code, I am able to start MyActivity.

I want to know how to do this declaratively from the XML file inside PreferenceScreen tag. How to do it without writing code, there must be some way.
12 years ago
There is a broadcast receiver for phone state, but I have not found one for accept or decline button. If someone, knows how to do this, please let me know.

12 years ago