Tag: java

Android Studio cannot import project: java.util.ArrayList cannot be cast to java.util.Map

When I’m trying to import my project through Android Studio I get this error. I have used gmaps in the project. How do I resolve this error? I’ve already re-installed Java and reset JAVA_HOME. I’ve also made sure Gradle is set up properly. 2013-12-23 11:13:35,448 [ 107774] WARN – nal.AbstractExternalSystemTask – Cause: java.util.ArrayList cannot be […]

Android: Limiting EditText to numbers

When creating an EditText in the java portion of the application, how do you limit it to numbers like you would in the xml? For example: new EditText(this); set like <EditText android:id=”@+id/h1″ android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:inputType=”numberDecimal”/>

Extract raw X.509 Certificate from a signed APK or JAR

I have a library of MD5 hashes of public keys used to sign various jars, and a mapping to their respective keystores which we use to sign different APKs. What I’d like to be able to do is identify which keystore was used to sign an APK, but without using trial and error. (Also, sadly, […]

How to insert “<<” text in TextView?

I need to insert “<<” in android:text = “<<” but there are raise problem with: Multiple annotations found at this line: – [I18N] Hardcoded string “<<“, should use @string resource – The value of attribute “android:text” associated with an element type “Button” must not contain the ‘<‘ character. Can you tell me how can I […]

ListView onScroll add more items

private class getArticles extends AsyncTask<Void, Void, Void> { String url; getArticles(String paramUrl) { this.url = paramUrl; } @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(App.this); mProgressDialog.setMessage(“Uńćitavanje artikala…”); mProgressDialog.setIndeterminate(false); mProgressDialog.setCancelable(false); mProgressDialog.show(); } @Override protected Void doInBackground(Void… params) { arraylist = new ArrayList<>(); try { Document document = Jsoup.connect(url).get(); Elements els = document.select(“ul.category3 > li”); […]

When to use synchronized in Java

I hope this is going to be enough information, so here it goes. If you need more info, lemme know in the comments. I have a class that has two inner classes. The inner classes each have two methods that call a method in the outer class. So, it looks like this: public OuterClass { […]

java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null (tess-two)

I am using sqlcipher.jar for encrypting database in android and also using it’s native library in libs/armeabi folder 1)libdatabase_sqlcipher.so 2)libsqlcipher_android.so 3)libstlport_shared.so and libs/x86 folder 1)libdatabase_sqlcipher.so 2)libsqlcipher_android.so 3)libstlport_shared.so and jar file named sqlcipher.jar in libs/ folder all i have imported now every thing is working fine it’s going good database is fetching and reading from sqlite […]

Getting device's local timezone

2010-06-14 02:21:49+0400 or 2010-06-14 02:21:49-0400 is there a way to convert this string to the date according to the local machine time zone with format 2010-06-14 02:21 AM

Button.setBackground(Drawable background) throws NoSuchMethodError

I’m implementing a simple method to add a Button to a LinearLayout programatically. When I invoke the setBackground(Drawable background) method, the following Error is thrown: java.lang.NoSuchMethodError: android.widget.Button.setBackground My addNewButton method: private void addNewButton(Integer id, String name) { Button b = new Button(this); b.setId(id); b.setText(name); b.setTextColor(color.white); b.setBackground(this.getResources().getDrawable(R.drawable.orange_dot)); //llPageIndicator is the Linear Layout. llPageIndicator.addView(b); }

Check if app is open during a GCM onMessage event?

I am wondering how to check if my application is open and currently visible to the user when receiving an onMessage() from GCM. At first, I was just using my own boolean isVisible, but then I realized this isn’t reliable, because if the app isn’t open, the object I use to access that flag is […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.