Android following class could not be found - android

I'am trying to load a spinner to my layout and keep geting this error:
The following classes could not be found:
- Spinner (Change to android.widget.Spinner, Fix Build Path, Edit XML)
heres my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Spinner
android:id="#+id/spn_dates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="displayDatesToSpiner" />
<ListView
android:id="#+id/LST_bought_products"
android:layout_width="match_parent"
android:layout_height="302dp" >
</ListView>
</LinearLayout>
Thanks

This sometimes happens when you rename the standard AppTheme in your android manifest. It will build and deploy just fine, but the xml design editor won't render it.

This is usually because there's an invalid attribute somewhere.
Remove the onClick and it will work.

Related

Imported code from another developer: <No resource identifier found for attribute 'ProgressColor' in package...> error in one of my .xml files

This is the .xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:seekarc="http://schemas.android.com/apk/res/com.pelkinsoft.enpower"
android:layout_width="match_parent"
android:layout_height="match_parent" >
The errors occur at:
<com.triggertrap.seekarc.SeekArc
android:id="#+id/seekArc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="30dp"
seekarc:progressColor="#color/arc_color"
seekarc:rotation="180"
seekarc:startAngle="30"
seekarc:sweepAngle="300"
seekarc:touchInside="true" />
I am new to Android and this is keeping me from being able to effectively work on this app. Any help would be much appreciated.
You must add the Seek Arc library (https://github.com/neild001/SeekArc#adding-to-your-project) to your project
Inside res foder, create following file:
res/values/color.xml
Then, define the color used by SeekArc view:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="arc_color">#0000FF</color>
</resources>
OR
Manually set the color in the SeekArk view:
<com.triggertrap.seekarc.SeekArc
android:id="#+id/seekArc"
android:layout_width="match_parent"
....
seekarc:progressColor="#0000FF"
....
/>

Code error in Android

So this is one of my codes and whenever I click run my project fails to build because of the error in this code
android:id="#+id/list_item_forecast_textview" />
for this code it says that there is unexpected end of file, beside the > in the code there is a small red zigzag line going across beside, > in the code. What should I do to fix the small code error?
#Simran:
I think you missing your Opening Tag Like < . Please add this .
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView android:id="#+id/list_item_forecast_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello,I am a TextView" />
</LinearLayout>
I think you are new in Android .So before start please read its official documents for xml Write the XML

No resource identifier found for attribute 'indicator_gravity' in package

I was trying to porting the Tree-View-List-Android into my project recently. I have created a project called com.dotnetideas.treeview and added everything in. I can run the demo without any issue. But when I use it in another project, I kept getting “No resource identifier found for attribute 'indicator_gravity' in package com.dotnetideas.treeview” in main_demo.xml.
Here is the xml looks like.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:treeView="http://schemas.android.com/apk/res/com.dotnetideas.treeview"
android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView android:layout_width="0dip" android:layout_height="0dip" android:scrollbars="vertical"
android:visibility="gone"> <!-- Just to test some attributes in IDE -->
</ListView>
<pl.polidea.treeview.TreeViewList android:id="#+id/mainTreeView" android:layout_width="fill_parent"
android:layout_height="fill_parent" treeView:indicator_gravity="right|center_vertical"
android:scrollbars="vertical" android:smoothScrollbar="true"/>
Although I followed the old code to changed the xml namespace from
xmlns:treeView=http://schemas.android.com/apk/res/pl.polidea.treeview
to
xmlns:treeView=http://schemas.android.com/apk/res/com.dotnetideas.treeview.
It doesn’t seem like valid xml namespace.
It turned out that the namespace needs to be
xmlns:treeView="http://schemas.android.com/apk/res-auto"
if we reference as a library project.
This answer from stackoverflow too didnt help.

Suspicious namespace: should start with http://

Problem Appeared : When i have open my XML file and changing the layout_height attribut.
Problem description : Suspicious namespace: should start with http://
Line problem* :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pj="http://schemas.android.com/apk/res/com.example"
xmlns:bm="com.example" <!-- problem line -->
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="#drawable/basic"
android:orientation="vertical" >
If you need a custom namespace, use the Android auto-namespace feature.
In your example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto" />
Clean your project and if the problem persist restart your IDE

Using Custom AutoCompleteTextView in Android Causes Error

I extended AutoCompleteTextView in android. When I use that new custom AutoCompleteTextView in my XML layout file, Eclipse shows an error saying:
You must specify a valid content view by calling setContentView() before attempting to show the popup. Exception details are logged in Window > Show View > Error Log"`.
Edited XML File is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.mypackage.MyAutoCompleteTextView
android:id="#+id/countries_list_custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionHint="Test">
<requestFocus />
</com.mypackage.MyAutoCompleteTextView>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
By simply taking out my custom view from the XML, the layout shows just fine.
Any help will be greatly appreciated, thanks.

Categories

Resources