i'm triing to use this directory picker: Android-DirectoryChooser
if i import it in eclipse like: file -> import -> existing and. proj. -> directory picker -> library and sample project
it gives this errors:
what am i doing wrong?or how to implement it in the right way?
errors:
The declared package "net.rdrei.android.dirchooser" does not match the expected package "main.java.net.rdrei.android.dirchooser"
Change the package name at top of the class ,It is the starting statement of your class and your own package ,where your getting the error right click on that you will have your own package...
Related
In MainAcitivity i am using Tools.systemBarLolipop() it is function from Tools.java file
in Tools.java there is window.setStatusBarColor(global.getIntDarkColor());
comes from window.java
in window.java all android.annotation import are error
I have include a jar file in my android project. Inside the jar file there is a class OverlayView in a package name android.widget. I can import the class into my Test.java file by import android.widget.OverlayView; and call the method init(). After these I can compile successfully. But while running the app it throws an exception
java.lang.NoSuchMethodError: android.widget.OverlayView.init
I didnt get class definition error
Your library contains android.widget? There is already a package with android.widget as its name. My guess is that it's conflicting with your library. Try deleting the import statements, by this time you should get an error because you deleted the import. Place your cursor in the method that has error then wait for the import suggestion to pop out, then alt+enter to import package. See if it is conflicting with the default android.widget package.
My activity_main.xml gives me an error which says activity_main cannot be resolved or is not a field
setContentView(R.layout.activity_main);
I did Android 2.2 while unchecking the x on "Create Activity" so everything was empty and I had to fill it!
On your project explorer
click on resources,then
click on layout,then
you see a "file_name.xml" if not rename it to "file_name.xml" by pressing F2 ,
then replace
setContentView(R.layout.activity_main);
with
setContentView(R.layout."file_name");
dont forget to add
import "YOUR_PACKAGE_NAME".R;
above class decleration
It looks like u have imported android.R instead of that you import your package name else make it as
setContentView(packgname.R.layout.activity_main);
If you are importing
import android.R;
remove this line and then press ctrl+shift+o(for import necessary packages R file)
Your eclipse IDE
Porject---->clean>Build Automatically
Import packagename.R
by pressing ctr+shift+o
I'm trying to figure out a way to share code across projets. this is what i did
created a project called sharecode and made the following class
package codelib.com;
public class cShape {
}
made a android project called testsharecode
whent to properties->java build path and clicked on projects at the top.
clicked add, and added sharecode
created a class to try include the cShape class from the sharecode project
package com.example.testsharecode;
import codelib.com
public class parent {
cShape test;
}
On my import i get a error saying
"only a type can be imported, cadelib resolves to a package"
on cShape i get a error saying the def does not exist.
How can project testsharecode use the code in projetc sharecode?
have you tried the following method :
right click on the distination projet, Build Path -> configure build path
chose project then select testsharecode
back in your distiation project now you should be able to use your public classes.
hope this helps
In some class of android source code ,they import com.android.mms.R, but I can't do it after I tryied. Are there any methods be used to import com.android.mms.R?
If your class already imported import com.android.R, delete it. and clean the project rebuild it. from projects>clean
if you have used any of Res by R.XXXX your project R will automatically get imported or do ctrl + shift + O
Also if it doesn't work go to property(right click on project)>Android here select target version as 4.0, then clean it will go.. first remove import com.android.R line from class