spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » ANDROID » Page 5
How I can get the latitude and longitude parameters inside the doInBackground method?
Well after so only had to do this to pass the coordinates. First add coordinate to constructor LatLng(double latitude, double longitude) and pass the parameters: lat = "-1.80"; lng = "-80.20"; LatLng latlng = new LatLng(lat, lng); new NameAsyncTask(context).execute(latlng); Then inside the doInbackground method get parameters: @Override protected String doInBackground(LatLng... params) { G

Categories : Android

How to use QAndroidJniObject to call Java code from inside Qt?
The Qt doc is pretty verbose on the subject: // Java class package org.qtproject.qt5; class TestClass { static String fromNumber(int x) { ... } static String[] stringArray(String s1, String s2) { ... } } // C++ code // The signature for the first function is "(I)Ljava/lang/String;" QAndroidJniObject stringNumber = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/TestClass",

Categories : Android

I can't post a json from an android app with httpUrlConnection to a NodeJs server
At least your JSON string is invalid. It should read {"regId": "APA91bGRb3Ad70sqWSUlNl4....."} You have to encode your JSON string correctly. As you're already using org.json, you could build the input JSON string like this: JSONObject json = new JSONObject(); json.putString("regId", regId); String jsonString = json.toString();

Categories : Android

Eclipse Luna - Android SDK
The only Eclipse Version with ADT incluced is Juno yet. You can try to download the single ADT-Plugin in Eclipse: https://dl-ssl.google.com/android/eclipse If you have the Android SDK installed you also have to add the directories "tools" and "platform-tools" to your environment path.

Categories : Android

How to add String Label to MPAndroidCharts
Actually, what I need it is not supported by the MPAndroidChart. Hence the only way to do that is to define two TextView for domain and range label respectively. Moreover, in order to have the range label as shown in the above figure I suggest to see this question which explain how to design a vertical TextView. It works for me.

Categories : Android

How to change status bar color to match app in Lollipop? [Android]
To change status bar color use setStatusBarColor(int color). According the javadoc, we also need set some flags on the window. Working snippet of code: Window window = activity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(activity.getResources().getColor

Categories : Android

Android radiogroup horizontal alignment contents not visible
With the current RadioGroup class implementation, you cannot have two rows of RadioButtons. So, either you set an HorizontalScrollView to your layout and allow the user to scroll to see all the RadioButtons or you use two RadioGroups, each of them containing 3 RadioButtons. So, using your example (with little variations), this last solution can be implemented like this: LinearLayout ll = (Line

Categories : Android

Eclipse Android imports is not recognized
Go to Project > Properties > Android and choose a build target. Your project at the moment has no build target, and so Eclipse does not know what android.jar file to use to resolve your imports.

Categories : Android

How can I make a multi-line EditText use the remaining space of a Linear or RelativeLayout
I think this idea will work: Use a RelativeLayout, set checkBox to alignParentLeft, set arrow to alignParentRight and set the following properties on EditText: set its width to match_parent, height to wrap_content, toRightOf checkBox and toLeftOf arrow. Maybe this will solve your issue I was talking about this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="ht

Categories : Android

Admob Adview Banner Ad show in Android apps
Have you added the AdActivity to the manifest? <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />

Categories : Android

Limit the input in an edit text
There's a property of EditText (in xml) called: android:inputType="number" You might be having a button click or something during which you would validate the EditText, there you can do something like this: int num = Integer.parseInt(editText.getText().toString()); if(num<1 || num>40) { // display a message that you have to write something to EditText first }

Categories : Android

Android In-app billing: the item you were attempting to purchase could not be found
I found that you actually have to publish the app before you can do any testing. That is not what the Google documentation says, and was not true when I implemented the v1 version of the API many years ago. But I do know I was always getting those purchase item could not be found errors until I really published my version of the TrivialDrive app.

Categories : Android

Android trying to move an imageview fluidly to where screen is tapped
ImageView splash ; @Override public boolean onTouchEvent(MotionEvent event) { float tx = event.getX(); float ty = event.getY(); int action = event.getAction(); switch(action) { case MotionEvent.ACTION_DOWN: tx = event.getX(); ty = event.getY(); // findViewById(R.id.character).setX(tx-45); // findViewById(R.id.character).setY(t

Categories : Android

Android Wear is collapsing group of 1 notification
Edit: the Android 5.0.1 update to Android Wear now properly handles this case! Original reply: Unfortunately, no - there is currently no special handling for groups of only one notification. In almost all cases, you should be updating the summary notification when your group changes - at that same point you should have enough information to determine if you only have one notification (and hence,

Categories : Android

Google Analytics Tracking with Android App Installs
Google Analytics provides referrer receiver implementation. You don't need to implement it yourself. The instruction for adding campaign attribution are in this dev guide https://developers.google.com/analytics/devguides/collection/android/v4/campaigns

Categories : Android

requestlocationupdate minTime is not working
It's safe to leave it registered, it has no effect on battery if you leave it there or register it over and over. from my experience multiply registration to location manager are doing a lot of problems over time, What I would do instead of you is to check every couple of minutes if the last received location was received in the last minute or so. If it didn't, register the listener again. Btw, w

Categories : Android

Auto code formatting in Android Studio
It is not possible other than via a macro. There is an outstanding feature request -- IDEABKL-5806 Automatically trigger code formatter on file save -- for such an action. There a bit of discussion on the ticket you may want to read. I recommend you vote for it. It is however a 4 year old request. And based on comments by JetBrains, it does not appear like it is a high priority item. Additional vo

Categories : Android

Build NDK sources without creating project
Following are the minimum steps that took me to to accomplish what you want. (I assume you already have downloaded and setup the Android SDK and NDK, and are building using ndk-build command from shell.) 1) Navigate to your preferred location and create the required folders: $ mkdir -p ndk-test/jni 2) Set NDK_PROJECT_PATH environment variable: $ export NDK_PROJECT_PATH=./ndk-test 3) Create

Categories : Android

Achieve setShadowLayer effect during drawCircle (or drawRoundRect) without turning off hardware acceleration
I had found a way to achieve such. First, we construct the ball + shadow off-screen image. Note, by using off-screen bitmap drawing technique, no GPU will be involved. The key is, don't use the Canvas from onDraw to perform drawCircle. Instead, construct our very own Canvas, backed by an off-screen bitmap. private Bitmap generateBallBitmap() { final int ballShadowSize = Utils.dpToPixel(BALL

Categories : Android

Generating random integer that never repeat for database id's
You can't simply do that as far as i know, but if you want unique numbers all the time why don't you fetch the timestamp? like this: long timestamp = Calendar.getInstance().getTime().getTime();

Categories : Android

android actionbar tab viewpage AsyncTask first tab is empty when started
You are using FragmentPagerAdapter please change it to FragmentStatePagerAdapter and run again Difference between FragmentPagerAdapter and FragmentStatePagerAdapter About FragmentPagerAdapter Google's guide says: This version of the pager is best for use when there are a handful of typically more static fragments to be paged through, such as a set of tabs. The fragment of each page the user vis

Categories : Android

onCreate() method calling instead of onUpgrade() method while updating database
It seems the database version is not correctly recorded unless you call getReadableDatabase or getWritableDatabase at some stage on creation of the db. According to user Vovkab, you should call either of these things in the constructor of your db to trigger the upgrade. EDIT: I just wanted to add a couple things to this answer - most notably, this answer is the best description of upgrading datab

Categories : Android

android art runtime check_jni.cc error on package name
I've had the same problem on upgrading to Android 5, and have just sorted it. The bug is in your native code, not in your java code. Somewhere in your native code you have a function that gets passed a FlacStreamEncoder object through jni as a jobject and you retrieve it with a line like: jclass streamEncoder = env->FindClass("fm.audioboo.jni.FLACStreamEncoder"); But JNI is supposed to use

Categories : Android

Communicator from a Fragment to a Dialog
Your code is not clear, why are you using a listener to your MainActivity that calls "onDataSave" when you already have the fragment variable in your calling method? You get a NullPointerException because the Fragment hasn't been added yet. The "show" method of a DialogFragment is asynchronous (it creates a FragmentTransaction and commits it). That's why the findFragmentByTag method returns null.

Categories : Android

Displaying Deck of Cards on Android's Different Screen Sizes
It depends on how you build the layouts. But essentially you should look into using displayMetrics: How to get screen display metrics in application class You can use that to determine the size (width/height) of the screen. You could also use nested, weighted LinearLayouts : How to set layout_weight attribute dynamically from code? There might be warnings about it being "slow" - but with this

Categories : Android

Android AppCompat Dark Theme Settings Checkbox
My guess is that's because the support library is not emulating the Holo theme anymore. Have you try defining the colorAceent your theme ? <style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> ... <!-- colorAccent is used as the default value for colorControlActivated, which is used to tint widgets --> <item name=”colorAccent”>@color/accent</item&

Categories : Android

How to pass intent but not starting activity immediately
If you send the intent via startActivity, it will start the activity. If you rather just want to keep the info for the further launches : The appropriate approach would be to use sharedpreferences. Save your data into sharedpreferences when you are in activity A When you launch the app again, check the preferences if there is any data, If there is data, simply get it and start activity B or ta

Categories : Android

Crash when using matrices as vertex shader attributes
This blurb of code is wrong: int handle = GLES20.glGetAttribLocation( programId, "vertexTransformation" ); GLES20.glEnableVertexAttribArray( handle ); GLES20.glVertexAttribPointer( handle, 16, GLES20.GL_FLOAT, false, 92, 28 ); Vertex attributes in OpenGL are always 4-component, thus a mat4 vertex attribute is actually 4 sequential 4-component arrays. This is the proper way of handling a mat4 v

Categories : Android

Able to fetch current location but its not accurate
This is because fetching location is a very complicated task to do. And the native implantation of LocationClient might not be the most accurate. Consider using one or all the 13 sensors(Table 1) in your device to improve that. TYPE_ACCELEROMETER Hardware Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of g

Categories : Android

Build path error after changing jdk compliance level
I would Suggest going through this . Did you change java version manually?if so then maybe you'd have to set classpath env.variables for same. Normally this error is caused by missing file hence linking error. one way-around could be to change the .classpath file encoding from UTF-8 to ASCII.or..explicitly add the default JRE library to the project. Do refresh eclipse in the end.

Categories : Android

Native android development without any java?
First, I believe you are worrying too much about the performance of java. You cannot avoid "java running in the background", because most of Android is implemented in Java, anyway. And the resources of smartphones are not so limited. Now if you really can't stand java, you can use a NativeActivity: http://developer.android.com/reference/android/app/NativeActivity.html And make your game with Open

Categories : Android

Is it possible to launch a web browser from my app, and return the clicked URL?
You can intercept any kind of URI in your WebView by using a custom WebViewClient: webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.contains("your_pattern")) { // Your stuff... return true; } return false; } }); From the official documentation: public

Categories : Android

Return value from Async Task class for reverse geocoding purpose
In short, you can't if it is a local to the doInBackground() method. The way to do it would be to wrap the interesting objects in a class and return an instance of that class. Then your post execute callback can use the objects as needed.

Categories : Android

android relative layout and image background
Try this: <RelativeLayout android:layout_width="1090dp" android:layout_height="1090dp" android:background="@drawable/backright3"> <TextView android:layout_width="1090dp" android:layout_height="1090dp" android:text="A" android:id="@+id/A" android:textColor="#ffffff" android:textSize="20sp" android:gravity="center"

Categories : Android

Android on Eclipse LogCat tag ServiceManager with text Waiting for service SurfaceFlinger keep looping
I used to have this same problem, It was because I had running in the background an android emulator outside of eclipse, in my case was the bluestacks emulator, when I stopped it my LogCat stopped printing that loop message. You should use this command in the adb command line, to use the adb command line, go to this path in your console; this is in windows. C:UsersYourUserAppDataLocalAndroids

Categories : Android

how to use mkfifo using Android's NDK
This happens if you build against the android-21 platform headers. Set APP_PLATFORM in jni/Application.mk to an older version, to build using the old headers, to make sure you only link to functions available earlier. (Before android-21, the C library features and headers didn't really change significantly, so for the normal C library functions, it doesn't matter if you build targeting android-3

Categories : Android

Updating android notification
Use deleteIntent to specify a PendingIntent to be executed when the user clears your notification. The intent to execute when the notification is explicitly dismissed by the user, either with the "Clear All" button or by swiping it away individually. This probably shouldn't be launching an activity since several of those will be sent at the same time.

Categories : Android

How to fit layout xml which is getting from server in Android
Do I here have to parse the xml then create the views dynamically ? Yes. but this approach will make things more hard because a lot of properties any view have and searching methods and setting correct position in view container looks like is not simple. Correct. You may wish to revisit your plan ("I am getting xml layout from a web service") and try to come up with a simpler solution.

Categories : Android

The method of type Fragment must override or implement a supertype method
Leave the configuration methods and their calls in the FragmentActivity, and create an interface to get/set the index there in the Fragment. In the Fragment: public class TopRatedFragment extends Fragment { public interface ISettings { public int getIndex(); public void setIndex(int index); } @Override public View onCreateView(LayoutInflater inflater, ViewGro

Categories : Android


Recently Add
Wait for all requests in Android Volley
android scrollview not working
Android: How to prevent a Wifi disconnect on DHCP renewal?
Using HorizontalScrollView for gallery - no pictures inside
-bash: export: not a valid identifier
m3u8 Video stops with MediaPlayer: Error (1,-1004)
java.lang.IndexOutOfBoundsException at ListView android
Facebook REST calls for mobile cross-platform app
How to returning image from camera intent and placing in google maps api v2 as thumbnail
How can I add a row to a ListView in one Fragment by clicking the button in another Fragment?
Using MediaController on Android 5
Is TCP packet filtering possible on mobile platforms?
Spinner from editext android
Incomplete file downloaded in android using DataInputStream
How do I delete a row form SQLite DB via ListView and refresh list view?
Change action bar to toolbar, and now I am having force closes. What am I doing wrong here?
Adding buttons below GraphView, all inside a Fragment
Get rotation and display in degrees
What methods are available to execute things in the background
Data Persistence Android
Intent not delivered correctly
Android Studio 1.0 RC 1 Gradle build issues - Could not run build action using Gradle installation
otto eventbus for android behaves differently in release build
How get item ID from ListFragment in android?
Receive bluetooth connection changes after reboot
Encrypting plain-text passwords and passing variables to xml for display in android
android html5 video fullscreenchange not called on entering fullscreen
Want to create API for my android application done using Intel XDK
Gps not getting location
Spannable Text is not working in Dialog Fragment
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.