Below is my XML code:
<com.github.pedrovgs.DraggableView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/draggable_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
draggable_view:enable_minimized_horizontal_alpha_effect="true"
draggable_view:top_view_height="200dp"
draggable_view:top_view_id="#+id/image"
draggable_view:bottom_view_id="#+id/ll"
draggable_view:top_view_margin_bottom="50dp"
draggable_view:top_view_margin_right="10dp"
draggable_view:top_view_resize="true"
draggable_view:top_view_x_scale_factor="2.3"
draggable_view:top_view_y_scale_factor="2.3">
<ImageView
android:id="#+id/image"
android:background="#drawable/imgone"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.github.pedrovgs.DraggableView>
I supposed to have dragabble view in my app.while running my app the following error throws:
Caused by: android.view.InflateException: Binary XML file line #8: For input string: "200.0dip"
Caused by: java.lang.NumberFormatException: For input string: "200.0dip"
There's a bug in that random github library you're using. It doesn't see 200dp as a number, presumably because its not expecting dp there. You're going to have to fix it yourself or contact the author and see if he's willing to do so. Or not use dp, and code around the scaling issues somehow.
Related
I have an AppWidget that is producing this error:
W/AppWidgetHostView: updateAppWidget couldn't find any view, using
error view
android.view.InflateException: Binary XML file line #2: Failed to
resolve attribute at index 1: TypedValue{t=0x2/d=0x7f01009a a=-1}
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute
at index 1: TypedValue{t=0x2/d=0x7f01009a a=-1}
I can tell the error is being caused by inflation of a layout, and I can pin it to the creation of a new RemoteViews in my RemoteViewsService.RemoteViewsFactory subclass' getViewAt() method:
#Override
public RemoteViews getViewAt(int position) {
[…]
final RemoteViews views = new RemoteViews(getPackageName(),
R.layout.appwidget_list_item);
[…]
return views;
}
Commenting this line out removes this particular error, and yet I cannot figure out what is wrong with the layout file it is referencing.
Layout file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout_view"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="?listPreferredItemHeight">
<TextView
android:id="#+id/item_name"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center_vertical"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingStart="?listPreferredItemPaddingLeft"/>
</LinearLayout>
The error is cause by using using theme attributes (such as ?listPreferredItemHeight) in an AppWidget layout, which isn't possible. These are the "unresolved attribute(s)" the error is referring to.
i'm new to android studio and my app is crushing besuase line of code
songProgressBar.setOnSeekBarChangeListener(this);
posting a question here helped me to realize it is a typo with an id in my layout. Well, here is the code for my layout with songProgressBar as an id.
<SeekBar
android:id="#+id/songProgressBar"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_above="#id/player_footer_bg"
android:thumb="#drawable/seek_handler"
android:progressDrawable="#drawable/seekbar_progress_blue"
android:paddingLeft="6dp"
android:paddingRight="6dp"/>
Now, i don't know what the typo is, and i don't know what i'm to do. the person who told me it is a typo said i should check whether the component is present in the layout when the activity is running. I've got no idea what I'm to do now. pls help.
There seems to be a null pointer exception.
21:39:10.999 1443-1443/? E/AndroidRuntime: Caused by: java.lang.NullPointerException 01-10 21:39:10.999 1443-1443/? E/AndroidRuntime: at com.example.passion.patrimusic.MainActivity.onCreate(MainActivity.java:86) 01-10 21:39:10.999
And from your above comment, its possible that songProgressBar is null.
If you are getting it from the layout, check if there's any typo in the Id and whether the component is present in the layout when the activity is running.
I'm trying to implement flowtextview into bauerca / drag-sort-listview but I'm getting an error inflating a row. Could you help me?
Error line is in (ResourceDragSortCursorAdapter.java (Bauerca)):
#Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return mInflater.inflate(mLayout, parent, false);
}
Eclipse says:
Ecipse says "FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #8: Error inflataing class com.pagesuite.flowtext.FlowTextView"
The row layout is:
<?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="67dp"
android:orientation="horizontal">
<com.pagesuite.flowtext.FlowTextView
android:id="#+id/nuevo_ingr_row_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#id/drag_handle"
android:layout_width="wrap_content"
android:layout_height="67dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:background="#drawable/ic_move" />
<ImageView
android:id="#id/click_remove"
android:layout_width="67dp"
android:layout_height="67dp"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:background="#drawable/ic_close" />
</com.pagesuite.flowtext.FlowTextView>
</LinearLayout>
It probably fails to find your com.pagesuite.flowtext.FlowTextView class.
First check if this class is actually in that package? Did you use a library or copy this class into your own project? If you copied it, you'll need to change the package to the correct value aka point it to your own class.
You got that error just because your xml layout file is not recognise the package com.pagesuite.flowtext.FlowTextView
If you change it to right one then error will not be there.
Feel free to comments.
I wrote the FlowTextView class. The project has had quite a few bug fixes and the JAR file hasn't been updated so I would advise against using the JAR file and check the whole source out and use it as a library project.
This means you get the latest version and it will probbly solve your import issue at the same time.
IF you are not familiar with library projects in eclipse then check this
I have an app made with monodroid, it's on release stage (ready to get released) but I would like to have a free ad-supported version of my app. I've been searching the web for a tutorial of Admob 6.1.0 implementation on monodroid without any luck. I'd have to mention that I've never worked with ads before.
I was wondering if anyone has been able to use Admob 6.1.0 on monodroid and if you could share your knowledge
I've seen this source code and also this tutorial, but I just can't manage to understand correctly how to implement it. I't would be nice if someone could make an answer as a community wiki so it can help others to get introduced to Admob in monodroid
EDIT:
Tried Greg Shackles sample step by step, i'm now getting this error android.view.InflateException: Binary XML file line #1: Error inflating class com.google.ads.AdView. Any sugestion of how to make it work?
EDIT 2:
Changed the XML file and now getting 2 new errors: Java.Lang.NoClassDefFoundError and System.TypeInitializationException. XML looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/Background2"
>
<com.google.ads.AdView android:id="#+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="AD_UNIT_ID_GOES_HERE"
ads:testDevices="TEST_EMULATOR,TEST_DEVICE_ID_GOES_HERE"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
And adview is called like this:
public class MyActivity : Activity
{
private View _adView;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.AboutActivityLayout);
AdMobHelper.RegisterEmulatorAsTestDevice();
_adView = FindViewById(Resource.Id.Ad);
AdMobHelper.RequestFreshAd(_adView);
loadData();
}
}
The first error you got "android.view.InflateException: Binary XML file line #1: Error inflating class com.google.ads.AdView" is related to the Jar Build Action setting.
You should check two things first:
the jar file has the Build Action property set to "AndroidJavaLibrary"
the java file called "AdMobHelper.java" should have the Build Action property set to "AndroidJavaSource"
It seems to me that the error you are getting now is related to the java file not being correctly configured as an AndroidJavaSource.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
My application was running fine but then I got the error and tried to re run the API, clean the build but nothing worked. When lookied into the logcat error found two errors with which I could find a solution for. The following are the errors.
11-08 21:50:09.981: ERROR/AndroidRuntime(352): Caused by: java.lang.ClassNotFoundException: android.view.Relativelayout in loader dalvik.system.PathClassLoader[/data/app/com.examples-1.apk]
11-08 21:50:09.981: ERROR/AndroidRuntime(352): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class Relativelayout
The following is the contents of my class:
public class Vathiyar extends Activity{
private Button findvathiyar;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vathiyar);
}
}
Following is my xml code..
<?xml version="1.0" encoding="utf-8"?>
<Relativelayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vathiyar_1"
android:orientation = "vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/widget32"
android:layout_width="wrap_content"
android:layout_height="-11px"
android:text="Welcome to the Selection of Vathiyar page"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
>
</TextView>
</Relativelayout>
Your problem is in your XML. You have RelativeLayout spelled incorrectly.
Change:
<Relativelayout ...
</Relativelayout>
To:
<RelativeLayout ...
</RelativeLayout>