English 中文(简体)
甲型六氯环己烷
原标题:Android Custom Widget Inflate Exception
  • 时间:2011-02-18 00:07:05
  •  标签:
  • android

<>XML

  <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res/com.org.BatteryManager"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      >
    <com.org.BatteryManager.BatteryView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:textColor="#ffffffff"
    />
    </LinearLayout>

Logcat

02-17 18:49:49.392: WARN/AppWidgetHostView(124): updateAppWidget couldn t find any view, using error view 02-17 18:49:49.392: WARN/AppWidgetHostView(124): android.view.InflateException: Binary XML file line #9: Error inflating class com.org.BatteryManager.BatteryView 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.widget.RemoteViews.apply(RemoteViews.java:930) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:219) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java:250) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.appwidget.AppWidgetHost$UpdateHandler.handleMessage(AppWidgetHost.java:73) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.os.Handler.dispatchMessage(Handler.java:99) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.os.Looper.loop(Looper.java:123) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.app.ActivityThread.main(ActivityThread.java:4627) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at java.lang.reflect.Method.invokeNative(Native Method) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at java.lang.reflect.Method.invoke(Method.java:521) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at dalvik.system.NativeStart.main(Native Method) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): Caused by: java.lang.ClassNotFoundException: com.org.BatteryManager.BatteryView in loader dalvik.system.PathClassLoader[.] 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.createView(LayoutInflater.java:466) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) 02-17 18:49:49.392: WARN/AppWidgetHostView(124): ... 15 more

问题回答

我有同样的混淆问题。 为了确定您的习俗,应当向施工人员提供两个论点: Context and AttributeSet asvisd here

页: 1 电池组

如果你想使用一种习俗观点,就有可能这样做。 这样做的方法是,在 Java建立一个习俗观类别,扩大某些基观成分类别。

例如,我的许多申请都使用习俗美术。 彩虹类只能转移一种 frame子或一种不同于违约行为的wi子。

我给我的习惯,是扩大基本美术堂——

package com.testing.whatever;

public class CustomGallery extends Gallery {
    //CODE OVERRIDES HERE
}

然后,在我的《刑法》中,该法典与你已经拥有的相似之处——

<com.testing.whatever.CustomGallery android:layout_width="fill_parent" android:layout_height="fill_parent" />

我怀疑你重犯了错误,因为你登上了编码。 电池组。 电池 意见或意见在你java档案中的错误位置。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签