how to import com.android.camera package in a java project - java

Hi I am writing a test using UIAutomator API , however in my java project I want to import the com.android.camera package.
However I am always getting an error that this import cannot be resolved.
I have added the android.jar in my build path and rest of the things work fine.
However I am not able to import this package.

There is no such package in android, maybe you are looking for
com.android.hardware.Camera
class ?
if so try
import com.android.hardware.Camera;

The camera class resides inside the below package so try to import below package instead of com.android.camera add the below.
import android.hardware.Camera;

import android.hardware.Camera;
try to place it after your package name

If you are using Eclipse than just press Ctrl + Shift + O Eclipse will automatically add the required libraries in your source code. If still you are getting import issue than you need to check if you are using correct API or the spelling is correct.

Related

java.util.logging does not exist bug?

I am trying to import java.util.logging into my class but it doesn't exist.
I am using Netbeans 8.2 installed just a few weeks ago, when I started learning Java and Netbeans.
I found this old bug report Bugzilla report but this is so old, I would expect it to be fixed, especially for a logging function.
The following is the only code I have in the class file. The 2 java.awt classes import OK. I added those just to prove that I had access to the standard Java library. The auto suggest does not suggest anything starting with log...
package myflag.flag.logging;
import java.util.logging;
import java.awt.Color;
import java.awt.Font;
Any ideas please???
Only a type can be imported. java.util.logging is a package. Please specify directly what class you need to import or you can import like this for all class inside this package: import java.util.logging.*;

Error to initialize the parse.com code in Android

I'm beginner with Java/Android and Parse. Today i need your help . I don't know what i'm doing wrong. Look to my picture
My .jar file is in "Lib" , but i'm receiving the red lines in my project.
Also ,how can you see in Parse.initialize seems that this is not recognized.
you should import classes
add this import statement to your codes
import com.parse.Parse;
and import every class you need
you can also import all classes
import com.parse.blablabla.....;
and if you have added .jar files you can fix imports in android studio .check this one
follow these steps
1) add parse libs to your project.
2)clean your project
3) add import statement
import com.parse.Parse;
you can see i have no error after i did those steps
this is my project no errors

what does it mean when there is import error?

I am using a code sample that suppose to be working, but I keep get an error with those 3 import statement.
import com.amazonaws.services.s3.transfer.internal.MultipartUploadCallable;
import com.amazonaws.services.s3.transfer.internal.PutObjectCallable;
import com.amazonaws.services.s3.transfer.internal.TransferStateUpdatingCallable;
the error message says : The import com.amazonaws.services.s3.transfer.internal.MultipartUploadCallable cannot be resolved
why is that happening and how can I solve it ?
Please add jars that contain this classes. This will always solve your problem.
This means that implementations of referenced classes cannot be found in classpath. Since you are using amazonaws you should add appropriate library to your project's dependencies.

Import issue in Eclipse

I have the following import in my java code in an eclipse project
import org.jscience.*;
However upon writing the code
Real r1 = new Real.valueOf(1);
I receive the error
Real cannot be resolved to a type
I am puzzled as to why this is happening as I am correctly importing (or so I believe)
Also to note, eclipse suggests using
import org.jscience.mathematics.number.Real;
But I am trying to avoid using the import for the full class location within the Jar.
Any ideas?
Thanks in advance
Martin
Try
import org.jscience.mathematics.number.*;
Because
import org.jscience.*;
will actually only import classes from within the jscience package and not any subpackages.
If we suppose your import is not throwing errors, try importing g.jscience.mathematics.number.*.

how to import javax in java?

I need an object of javax.servlet.jsp.JspWriter in my JAVA program. I have to import javax, but I do not know how to do it.
I use ant for compiling my project and no IDE, just commandline.
Should I download a package or something and put it in my project? Or there is another way?
An IDE would ease thing considerable. Ant intergrates with Eclipse and helps to ease management of imports.
For the commandline; download the appropriate jar, add it to the classpath using -Djava.ext.dirs=
I presume that you can take it from here!
To import javax.servlet.jsp.JspWriter you place an import statement at the top of your file, after the package declaration, but before the class declaration. The import statement would look like:
import javax.servlet.jsp.JspWriter;
This tells the compiler to interpret uses of JspWriter as javax.servlet.jsp.JspWriter
For example:
package somepackage;
import javax.servlet.jsp.JspWriter;
public class AClass {
//Class contents here
}
I need an object of javax.servlet.jsp.JspWriter in my JAVA program. I
have to import javax
No you don't, you have to import javax.servlet.jsp.JspWriter. So do that. If it doesn't compile, adjust your classpath or your IDE project settings to include the appropriate JAR file.

Categories

Resources