Note that there are some explanatory texts on larger screens.

plurals
  1. POClassNotFoundException RemoteViews
    primarykey
    data
    text
    <p>I create own control extends from TextView. I try use this control in RemoteViews on notification. But problem, if I try show notify, get error:</p> <p>java.lang.ClassNotFoundException: {namespace}.{myClass}.</p> <p>But if I add same control in activity layout. All ok. What's the problem?</p> <p>My TextView:</p> <pre><code>public class ScrollingTextView extends TextView { public ScrollingTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public ScrollingTextView(Context context, AttributeSet attrs) { super(context, attrs); } public ScrollingTextView(Context context) { super(context); } @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { if (focused) super.onFocusChanged(focused, direction, previouslyFocusedRect); } @Override public void onWindowFocusChanged(boolean focused) { if (focused) super.onWindowFocusChanged(focused); } @Override public boolean isFocused() { return true; } </code></pre> <p>}</p> <p>My notify layout:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;ImageView android:id="@+id/notification_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:background="@drawable/ic_launcher" /&gt; &lt;TextView android:id="@+id/notification_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/notification_image" android:text="notification_title" android:textStyle="bold" /&gt; &lt;{namespace}.ScrollingTextView android:id="@+id/notification_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/notification_title" android:layout_toRightOf="@+id/notification_image" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" android:text="notification_message" /&gt; </code></pre> <p></p> <p>Notification call:</p> <pre><code>Intent intent = new Intent(context, NotificationActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification notification = new Notification(R.drawable.ic_launcher, tickerText, System.currentTimeMillis()); notification.setLatestEventInfo(context, contentTitle, contentText, pendingIntent); RemoteViews contentView = new RemoteViews(_context.getPackageName(), R.layout.notify); contentView.setImageViewResource(R.id.notification_image, R.drawable.ic_launcher); contentView.setTextViewText(R.id.notification_title, state.contentTitle); contentView.setTextViewText(R.id.notification_message, state.contentText); notification.contentView = contentView; _notificationManager.notify(1, notification); </code></pre> <ul> <li>UPDATE 05.08.2012 17:08</li> </ul> <p>In android manifest I have value package="com.test".</p> <p>Under {namespace} I understoo com.test, and {myClass} - ScrollingTextView. ScrollingTextView placed at package com.test.</p> <p>Error occured: android.view.InflateException: Binary XML file line #25: Error inflating class com.test.ScrollingTextView.</p> <p>Where line 25 is line, where declared ScollingTextView: </p> <pre><code>&lt;com.test.ScrollingTextView ... </code></pre> <p>Full error:</p> <pre><code>couldn't inflate view for notification com.test/0x1 android.view.InflateException: Binary XML file line #25: Error inflating class com.test.ScrollingTextView at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.widget.RemoteViews.apply(RemoteViews.java:1580) at com.android.systemui.statusbar.tablet.TabletStatusBar.inflateViews(TabletStatusBar.java:1938) at com.android.systemui.statusbar.tablet.TabletStatusBar.addNotificationViews(TabletStatusBar.java:1744) at com.android.systemui.statusbar.tablet.TabletStatusBar.addNotification(TabletStatusBar.java:891) at com.android.systemui.statusbar.CommandQueue$H.handleMessage(CommandQueue.java:231) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: com.test.ScrollingTextView at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.view.LayoutInflater.createView(LayoutInflater.java:552) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) ... 16 more </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload