unable to create service caused by exception - android

hi i am developing an application using a third party libraries.I am getting unable to create service and the log cat shows it is caused by client exception and the sdk guide says it as: This class throws the exceptions specific to errors that occur within the SDK.So is there a way to handle the errors within sdk.Please let me know your ideas
logcat:
10-03 16:59:48.288: E/AndroidRuntime(14268): FATAL EXCEPTION: main
10-03 16:59:48.288: E/AndroidRuntime(14268): java.lang.RuntimeException: Unable to create service com.xyz.android.ui.service.security.UserLoginService: com.xyz.android.core.exception.xyz ClientException
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2697)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.app.ActivityThread.access$1700(ActivityThread.java:159)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.os.Looper.loop(Looper.java:137)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.app.ActivityThread.main(ActivityThread.java:5419)
10-03 16:59:48.288: E/AndroidRuntime(14268): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 16:59:48.288: E/AndroidRuntime(14268): at java.lang.reflect.Method.invoke(Method.java:525)
10-03 16:59:48.288: E/AndroidRuntime(14268): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
10-03 16:59:48.288: E/AndroidRuntime(14268): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
10-03 16:59:48.288: E/AndroidRuntime(14268): at dalvik.system.NativeStart.main(Native Method)
10-03 16:59:48.288: E/AndroidRuntime(14268): Caused by: com.xyz.android.core.exception.xyzClientException
10-03 16:59:48.288: E/AndroidRuntime(14268): at com.xyz.android.config.XyzApplicationConfig.getHostContext(XyzApplicationConfig.java:160)
10-03 16:59:48.288: E/AndroidRuntime(14268): at com.xyz.android.core.service.SecurityManagerService.<init>(SecurityManagerService.java:117)
10-03 16:59:48.288: E/AndroidRuntime(14268): at com.xyz.android.ui.service.security.UserLoginService.onCreate(UserLoginService.java:100)
10-03 16:59:48.288: E/AndroidRuntime(14268): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2687)

Find the technical support for whatever library is providing you with com.xyz.android.ui.service.security.UserLoginService, and ask them what a com.xyz.android.core.exception.xyzClientException is.

Related

Can run system camera app but not my own camera app on emulator

I have created a simple camera app, exactly like they have done in this example http://developer.android.com/guide/topics/media/camera.html#custom-camera. But the problem is that i can't get it to work on the android emulator. The system camera app works perfecly on the emulator, but my app just crash when i try to run it. The emulator is a nexus 5 with no skin and the camera is simulated. I have tried different to change device but still same problem.
This is the logcat after it has crashed:
`10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: FATAL EXCEPTION: main
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: Process: bajsa.myapplication, PID: 3146
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.setPreviewDisplay(android.view.SurfaceHolder)' on a null object reference
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at bajsa.myapplication.CameraPreview.surfaceCreated(CameraPreview.java:30)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.SurfaceView.updateWindow(SurfaceView.java:582)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:177)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2055)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:670)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:606)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-03 15:53:16.750 3146-3146/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)`
`10-03 15:53:36.270 1796-1808/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.`
`10-03 15:57:50.330 1027-1027/? I/perfprofd: profile collection skipped (running in emulator)
10-03 16:08:07.460 1349-1365/? E/BluetoothAdapter: Bluetooth binder is null
10-03 16:08:07.460 1349-1365/? E/KernelCpuSpeedReader: Failed to read cpu-freq
10-03 16:08:07.460 1349-1365/? E/KernelCpuSpeedReader: java.io.FileNotFoundException: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)`
Why doesn't it work?

NullPointer exception when using ListView

I've got following code, which gets launched as a second activity:
public class SensorActivity extends Activity implements SensorEventListener{
List<Sensor> sensors;
Sensor selectedSens;
SensorManager SensMng;
ArrayAdapter<String> adapter;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sensor);
final ListView listSensors = (ListView) findViewById(R.id.listvalues);
SensMng = (SensorManager) getSystemService(SENSOR_SERVICE);
sensors = SensMng.getSensorList(Sensor.TYPE_ALL);
ArrayAdapter<Sensor> adapter = new ArrayAdapter<Sensor>(this, android.R.layout.simple_list_item_1, sensors);
listSensors.setAdapter(adapter);
}
Here's my XML file:
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listvalues"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
I keep on getting a nullpointer exception:
10-03 21:46:57.475: E/AndroidRuntime(9893): FATAL EXCEPTION: main
10-03 21:46:57.475: E/AndroidRuntime(9893): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ch.ethz.inf.vs.android.spurra.sensors/ch.ethz.inf.vs.android.spurra.sensors.SensorActivity}: java.lang.NullPointerException
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread.access$600(ActivityThread.java:140)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.os.Looper.loop(Looper.java:137)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread.main(ActivityThread.java:4898)
10-03 21:46:57.475: E/AndroidRuntime(9893): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 21:46:57.475: E/AndroidRuntime(9893): at java.lang.reflect.Method.invoke(Method.java:511)
10-03 21:46:57.475: E/AndroidRuntime(9893): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
10-03 21:46:57.475: E/AndroidRuntime(9893): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
10-03 21:46:57.475: E/AndroidRuntime(9893): at dalvik.system.NativeStart.main(Native Method)
10-03 21:46:57.475: E/AndroidRuntime(9893): **Caused by**: java.lang.NullPointerException
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.Activity.findViewById(Activity.java:1882)
10-03 21:46:57.475: E/AndroidRuntime(9893): at ch.ethz.inf.vs.android.spurra.sensors.SensorActivity.<init>(SensorActivity.java:24)
10-03 21:46:57.475: E/AndroidRuntime(9893): at java.lang.Class.newInstanceImpl(Native Method)
10-03 21:46:57.475: E/AndroidRuntime(9893): at java.lang.Class.newInstance(Class.java:1319)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
10-03 21:46:57.475: E/AndroidRuntime(9893): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
10-03 21:46:57.475: E/AndroidRuntime(9893): ... 11 more
All I did was really just copy past from my main activity, plus adjusting the values. The main activity works without any problems, this one however doesn't. I've tried cleaning, rebuilding the project, to no avail.
Can anyone please tell me whats wrong?
Thanks,
Regards
I've declared " final ListView listVals = (ListView) findViewById(R.id.listvalues);" as a field, so before running setContentView(). Once I've moved it into the actual function, it worked. So I assume that was causing it to return null?
Yes. If you call findViewById(R.id.someId); before calling setContentView(R.layout.someLayout); it will return null because you haven't yet inflated your layout which contains the View id you are trying to find.
Basically, your Views exist inside of your layout so if you try to use findViwById() before you inflate your layout (usually with setContentView()) then there is nothing to find. So you will get NPE when you try to use like when you call a function on it.
If your project has external jar files, go to Project->properties->order and export and select all external jar files. That should do the work.

Android fragments backward compatibility

I am trying to do a android application where we need to use the fragments. I am following the rule while i am doing with backward compatibility. i.e. Extends FragmentActivity instead of Activity and i use the use the getSupportFragmentManager() also. The same code working with 4.1 but not working with 2.2 .
i using the
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
String newTime = String.valueOf(System.currentTimeMillis());
DetailFragment fragment = (DetailFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.detailFragment);
if (fragment != null && fragment.isInLayout()) {
fragment.setText(newTime);
} else {
Intent intent = new Intent(getActivity().getApplicationContext(), DetailActivity.class);
intent.putExtra("value", newTime);
startActivity(intent);
Can any one help ? i am getting the force close. that unable start the activity component info.
it's showing error at setContentView() main activity ,which contains the framents .
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<fragment
android:id="#+id/listFragment"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_marginTop="?android:attr/actionBarSize"
class="com.example.fragmentsample.MyListFragment" ></fragment>
<fragment
android:id="#+id/detailFragment"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent"
class="com.example.fragmentsample.DetailFragment" >
<!-- Preview: layout=#layout/details -->
</fragment>
</LinearLayout>
logcat:
10-03 16:03:54.586: E/AndroidRuntime(649): FATAL EXCEPTION: main
10-03 16:03:54.586: E/AndroidRuntime(649): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fragmentsample/com.example.fragmentsample.RssfeedActivity}: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.os.Looper.loop(Looper.java:123)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-03 16:03:54.586: E/AndroidRuntime(649): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 16:03:54.586: E/AndroidRuntime(649): at java.lang.reflect.Method.invoke(Method.java:507)
10-03 16:03:54.586: E/AndroidRuntime(649): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-03 16:03:54.586: E/AndroidRuntime(649): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-03 16:03:54.586: E/AndroidRuntime(649): at dalvik.system.NativeStart.main(Native Method)
10-03 16:03:54.586: E/AndroidRuntime(649): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x2
10-03 16:03:54.586: E/AndroidRuntime(649): at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:3692)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1400)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1326)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:47)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.view.LayoutInflater.rInflate(LayoutInflater.java:625)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-03 16:03:54.586: E/AndroidRuntime(649): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.Activity.setContentView(Activity.java:1657)
10-03 16:03:54.586: E/AndroidRuntime(649): at com.example.fragmentsample.RssfeedActivity.onCreate(RssfeedActivity.java:10)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-03 16:03:54.586: E/AndroidRuntime(649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-03 16:03:54.586: E/AndroidRuntime(649): ... 11 more
In your XML file you need to supply the full path to Fragment:
<android.support.v4.app.Fragment
android:id="#+id/detailFragment"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="match_parent"
class="com.example.fragmentsample.DetailFragment" >
<!-- Preview: layout=#layout/details -->
</android.support.v4.app.Fragment>

Custom Pinch To Zoom View

I am trying to implement Pinch To Zoom on an Android app I am working on. For this, I have made a Java Class called PinchToZoom using the Android developer's website. However, if I try to launch my app I get an error in my XML file. I am confused as to why though, because I thought I had implemented it correctly. This is the XML code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#222222"
android:orientation="vertical" >
<com.andriesse.athena.PinchToZoom
android:id="#+id/selectedImage"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:adjustViewBounds="true"
android:contentDescription="#string/content" />
</LinearLayout>
I hope you guys can help me out!
EDIT:
I forgot to add the error log before, so here it is:
10-03 13:35:40.207: E/AndroidRuntime(2421): FATAL EXCEPTION: main
10-03 13:35:40.207: E/AndroidRuntime(2421): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andriesse.athena/com.andriesse.athena.ImageEditing}: android.view.InflateException: Binary XML file line #8: Error inflating class com.andriesse.athena.PinchToZoom
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread.access$600(ActivityThread.java:127)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.os.Looper.loop(Looper.java:137)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread.main(ActivityThread.java:4441)
10-03 13:35:40.207: E/AndroidRuntime(2421): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 13:35:40.207: E/AndroidRuntime(2421): at java.lang.reflect.Method.invoke(Method.java:511)
10-03 13:35:40.207: E/AndroidRuntime(2421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-03 13:35:40.207: E/AndroidRuntime(2421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-03 13:35:40.207: E/AndroidRuntime(2421): at dalvik.system.NativeStart.main(Native Method)
10-03 13:35:40.207: E/AndroidRuntime(2421): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.andriesse.athena.PinchToZoom
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.createView(LayoutInflater.java:589)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
10-03 13:35:40.207: E/AndroidRuntime(2421): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.Activity.setContentView(Activity.java:1835)
10-03 13:35:40.207: E/AndroidRuntime(2421): at com.andriesse.athena.ImageEditing.onCreate(ImageEditing.java:26)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.Activity.performCreate(Activity.java:4465)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
10-03 13:35:40.207: E/AndroidRuntime(2421): ... 11 more
10-03 13:35:40.207: E/AndroidRuntime(2421): Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
10-03 13:35:40.207: E/AndroidRuntime(2421): at java.lang.Class.getConstructorOrMethod(Class.java:460)
10-03 13:35:40.207: E/AndroidRuntime(2421): at java.lang.Class.getConstructor(Class.java:431)
10-03 13:35:40.207: E/AndroidRuntime(2421): at android.view.LayoutInflater.createView(LayoutInflater.java:561)
10-03 13:35:40.207: E/AndroidRuntime(2421): ... 22 more
This is the key line:
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
Make sure that your custom listview has these constructors:
public PinchToZoom(Context context) {
this(context, null);
}
public PinchToZoom(Context context, AttributeSet attrs) { // <--- missing?
this(context, attrs, 0);
}
public PinchToZoom(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// initialisation code here
}
I've chained them this way so you never have to do anything except in the 3rd constructor. If you have these constructors, and they don't have external dependencies that can only be resolved at runtime, your custom listview will also preview correctly.
Instead of creating an xml node of type com.andriesse.athena.PinchToZoom, try creating one of type view and giving it a class attribute of class= "com.andriesse.athena.PinchToZoom", like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#222222"
android:orientation="vertical" >
<view
class="com.andriesse.athena.PinchToZoom"
android:id="#+id/selectedImage"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:adjustViewBounds="true"
android:contentDescription="#string/content" />
</LinearLayout>
EDIT: also, instead of writing your own pinch-zoom code, you may want to try using this: https://github.com/jasonpolites/gesture-imageview
I used it on a previous project and it worked great for me.

Starting the InCallScreen activity

I am doing an application which utilize the incoming call screen of Android with the follow code:
Intent inCallIntent = new Intent();
inCallIntent.setClassName("com.android.phone", "com.android.phone.InCallScreen");
startActivity(inCallIntent);
But I received the follow error:
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): java.lang.RuntimeException: Error receiving broadcast Intent { act=...alarmservice flg=0x4 (has extras) } in ...CallMeSoon$2#44635330
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:771)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.os.Handler.handleCallback(Handler.java:609)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.os.Handler.dispatchMessage(Handler.java:92)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.os.Looper.loop(Looper.java:123)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.ActivityThread.main(ActivityThread.java:4595)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at java.lang.reflect.Method.invokeNative(Native Method)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at java.lang.reflect.Method.invoke(Method.java:521)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at dalvik.system.NativeStart.main(Native Method)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.phone/.InCallScreen } from ProcessRecord{449ae8e0 1495:....callmesoon/10099} (pid=1495, uid=10099) requires null
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.os.Parcel.readException(Parcel.java:1218)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.os.Parcel.readException(Parcel.java:1206)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1226)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.Activity.startActivityForResult(Activity.java:2789)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.Activity.startActivity(Activity.java:2895)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at ....CallMeSoon$2.onReceive(CallMeSoon.java:304)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:760)
10-03 17:23:30.802: ERROR/AndroidRuntime(1495): ... 9 more
I know that the permission from somewhere is missed. But what could be?
Updated: The permission is neither
android.permission.CALL_PHONE
nor
android.permission.CALL_PRIVILEGED
Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.phone/.InCallScreen } from ProcessRecord{449ae8e0 1495:....callmesoon/10099} (pid=1495, uid=10099) requires null
this is the root cause, and it arises due to double entry of application component in the application Manifestfile. you might have declared InCallScreen activity more than one time in your manifest file.
Just double check it.!!
Add this to AndroidManifest.xml
android.permission.CALL_PHONE
or
android.permission.CALL_PRIVILEGED
Also aren't you missing the phone number to dial usually you set this in the intents data. You need to setup your Intent like this if you want to make a call or use these other Intent actions
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:+15554441212"));
startActivity(intent);

Categories

Resources