import android_view_TextureView not found - java

i can't import android.view.TextureView.
All other import work except android.view.TextureView. i download the textureView.java but can't compile, because of other unknown type like private HardwareLayer mLayer.
i see that every body import it without any error.

TextureView was added in API level 14. In order to use it, you must target your app to at least this API level.

Related

How to use JLex.CAlloc.class

I downloaded and imported xalan-2.5.0.jar to my netbeans project in order to use the CAlloc.class function. But i cant figure out how to use the CAlloc function.
i imported the package by doing this,
import JLex.*;
i wanted to import specifically the calloc class but i get error when i tried this
import JLex.CAlloc;
the error says "CAlloc is not public in JLex; cannot be accessed from outside package" , i opened and checked the CAlloc.class and it not public but i cant edit it, may be if there is a way to edit the class ???

Can't resolve symbol toJson

I'm using json4s in a play project, and I'm also using a library called sbt-buildinfo which generates Scala source from your build definitions.
Now, in the sbt-buildinfo library the say you need to add some line of code: buildInfoOptions += BuildInfoOption.ToJson so you can use .toJson, but from some reason I can use .toJson.
this is how I do it:
import _root_.util.{AuthenticatedAction}
import buildinfo.BuildInfo
import com.google.inject.Inject
import org.json4s.BuildInfo
import play.api._
import play.api.mvc._
class AppInfo #Inject()(implicit configuration: Configuration) extends Controller {
def appVerion = AuthenticatedAction {
Ok(BuildInfo.toJson)
}
but the import buildinfo.BuildInfo stays gray....so it looks like I'm not using it. I refreshed the build.sbt and all, what could it be?
You have multiple imports to a BuildInfo object. org.json4s.BuildInfo will probably shadow your buildInfo.BuildInfo import and therefore, it does not have the required member. Try writing out the entire package name that you need:
Ok(buildinfo.BuildInfo.toJson)

Android Studio - why import statement is unused/not needed?

In an Android studio library project, the following code piece gives error.
package my.package.a;
import my.package.b.Test; //this shows unused, why??
public class **Test** extends my.package.b.Test { //"Test is already defined in this compilation unit." why?
...
}
extends my.package.b.Test this line is using package b, isn't it? so why the import statement shows unused?
These two Test classes are in different packages, why does it have name conflicts??
Solution:
Refer to full name and delete import statement.
Cannot import my.package.b.Test as it's in conflict with current class name.
The import is not needed here because you're already calling out my.package.b.Test by full name. If you use the fully qualified reference to a symbol, there is no need to import it.

Why do I get "Type okhttp3.Call does not have type parameters" when using Retrofit2?

I am trying to follow this tutorial for Retrofit2 Getting Started and Create an Android Client.
The imports are fine
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
and I can follow the tutorial fine except for one thing. I am trying to create the GitHubService Interface and I run into two problems: The Call<V> says that it doesn't take any type parameters and I am also unsure where to put the Contributor class since it's according to the tutorial only declared as static, does that mean it's nested somewhere?
import okhttp3.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
public interface GitHubClient {
#GET("/repos/{owner}/{repo}/contributors")
Call<List<Contributor>> contributors(
#Path("owner") String owner,
#Path("repo") String repo
);
}
static class Contributor {
String login;
int contributions;
}
I have the Contributor class in a separate file and have it as public.
Also, the Call class does not import automatically in Android Studio, I have to select it manually, but it's the only Call I got (except for Androids phone api)
Please help me with why I get this errors, from what I can see there is no one around with the same thing so I am missing something fundamental.
Accordingly to the compile time error you are getting you did import Call from the wrong package. Please, check your import and be sure that you have
import retrofit2.Call;
everything Retrofit related import should be from the package retrofit2.
On the other hand
Call contributors(
it can't guess what you want to return. A Contributor ? a List<Contributor> maybe? E.g.
public interface GitHubClient {
#GET("/repos/{owner}/{repo}/contributors")
Call<List<Contributor>> contributors(
#Path("owner") String owner,
#Path("repo") String repo
);
}

Receiving multiple syntax errors when using registerServlet method

I am trying to implement JUnit unit testing using a ServletUnit to test a servlet, specifically a java file named SignedNotesServlet.java . This test class is in the same directory as SignedNotesServlet.java . I am using Eclipse.
However, I am having trouble writing the correct syntax for registerServlet method that is part of ServletUnit and HttpUnit. I have not yet run the program. The errors I am receiving are
Syntax error on tokens, FormalParameter expected instead
Syntax error on token "class", identifier expected
Syntax error on token(s), misplaced construct(s)
Syntax error on token ""SignedNotesServlet"", invalid FormalParameterList
Here is my code:
package notetaker;
import com.meterware.servletunit.ServletRunner;
import com.meterware.servletunit.ServletUnitClient;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.fail;
public class SignedNotesServletTest {
ServletRunner sr = new ServletRunner();
sr.registerServlet( "SignedNotesServlet", SignedNotesServlet.class.getName() );
private SignedNotesServlet signednotes;
#Test
public void test() {
fail("Not yet implemented");
}
}
I think I correctly added the jar file the buildpath, using instructions from http://tinyurl.com/ku7huss . I used http://tinyurl.com/b55fn as my main reference but am also looking at the few registerServlet examples on the web (I can't post those links for reference since I need a 10 reputation to post more than 2 links). I am not entirely sure what could be wrong since I basically copy-pasted from the second website and made (what I thought) were appropriate changes.
I also thought that maybe something was wrong with "SignedNotesServlet" since there were quadruple quotes in the error, and I removed them, but it still doesn't work out, and I don't think that would have been correct syntax anyway, based on the examples.
This is the problem:
sr.registerServlet( "SignedNotesServlet", SignedNotesServlet.class.getName() );
This statement isn't in a method or constructor - it needs to be. Either put it within the test itself or put it in a setup method. If you put that code into the individual test, I'd also recommend making sr a local variable for that test. If you put it into a setup method, you'd need sr to be an instance variable still, but I'd suggest making it private and giving it a more useful name.
I am not entirely sure what could be wrong since I basically copy-pasted from the second website
But you copied it into an inappropriate place. Note that this has nothing to do with servlets, JUnit, ServletUnit or your build path - it's simply invalid Java.

Categories

Resources