Questions tagged [android]

324532 questions
1

votes
3

answer
2.5k

Views

How to format mySQL date to show in datepicker in android?

When I get a date from mySQL, its in the format 2013-06-05, but when I try to display it in a datepicker dialog, I am getting the year 1933 and the month and day is also not right... The variable Setdate would be the string "2013-06-05". public void onClick(View v) { // TODO Auto-generated method st...
sneaky
1

votes
3

answer
1.7k

Views

TextView won't center vertically in parent

My activity has only a single TextView and I am trying to get the text to center vertically but it ends up aligning to the bottom. I tried changing several properties but no luck. Here is currently what I have (Android 2.3): EDIT: I am actually setting the textsize in code and it is to a large value...
AndroidDev
1

votes
2

answer
3.3k

Views

SQLite Union of n tables with m columns

I have this problem. There are n tables created dynamically and each table has m columns, the columns could be repeated. This tables have in common 2 columns but there is no related data between them, for example: Table1 | A | B | Col1 | Col2 | Table2 | A | B | Col3 | Col4 | Table3 | A | B | Col1 |...
cbedoya
1

votes
3

answer
2.5k

Views

how to stop android emulator from automatically turning off

I am using the SDK provided from the android developers website. My android emulator seems to turn off automatically after some period of inactivity. I need to press the power hardware button provided next to the emulator screen to be able to run applications again. The problem is that I don't know...
user13267
1

votes
3

answer
125

Views

outofmemory error using bitmaps Android

I've created an android app, which chooses a picture from Gallery and displays a preview. @Override public void onClick(View v) { if (v.getId()== R.id.button){ Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK); startActivityForResult(Intent.createChooser(...
Frankenstein
1

votes
3

answer
472

Views

Copy fileto SD Card from Raw folder after context-menu selection?

I'm (slowly) making an app which displays a list of tones and lets the user "long press" a certain one which then brings up a context menu asking if you'd like to copy it to SD card. Only problem is that last part, I need help. Basically the tones are stored in the Raw folder, and I need it that it...
Sean Burrage
1

votes
1

answer
683

Views

Geographic coordinates to screen coordinates algorithm

I'm developing a cross platform mobile application that stores positions as geographic coordinates into a db, each of these points represent the top left corner of a graphical object. This application contains a map control (radmap from telerik), that supports geographic coordinates, so, you just ad...
lpinho
1

votes
2

answer
1.4k

Views

Loading background in andengine

I am new in game development of android and after searching i have finally found that i have to work with andengine and i have started that but i am facing some issue i have 2 classes one is main activity its code is as follow package com.game.day1v1; import org.andengine.engine.camera.Camera; impo...
Waleed Ahmed
1

votes
3

answer
2.1k

Views

What does android Wifi ScanResult.level value means?

I'm trying to make an app that can measure of a detected Wifi signal strength. i'm using this code for (int i=0; i
randms26
1

votes
3

answer
117

Views

Comparing Usernames on Android using an array

I'm making a simple form and I want to use an array stored in my strings.xml to compare with text entered by the user. Resources res = getResources(); String[] usernameArray = res.getStringArray(R.array.usernames); int userint = usernameArray.length; for(int x=0;x
Will Nasby
1

votes
4

answer
3.8k

Views

Android WebView getFavicon() returning null

I'm trying to get the favicon of the loaded page after using WebView webView = new WebView(getActivity()); webView.loadUrl("http://" + url); I'm attaching the asynchronous WebViewClient to the WebView to get the favicon after it loads webView.setWebViewClient(new WebViewClient() { @Override public v...
Jason Hu
1

votes
2

answer
103

Views

Add inputListener to texture

I have written a game in libgdx. Everything works fine, except one thing: When the player loses, a "Game Over" texture gets displayed to the screen. I'd like to add a "tap screen to restart" function to the game, but to do this, I need to attach an eventListener to the whole texture. Is this possibl...
PeterInvincible
1

votes
1

answer
693

Views

Where to Set Custom Typeface in Custom View Class (extends Button)?

I have a custom View class that extends Button. I'd like to set a custom Typeface to all instances of this class, but since some methods get called multiple times in a view, I was wondering what is the best overwriting method to place the following code in? final Typeface face = Typeface.createFromA...
Dzhuneyt
1

votes
2

answer
2.3k

Views

Force refresh of CSS files

I have a WebView that loads HTML files from within the private data of my app. I load those files from a server, then saves them to the private data folder. They come with JavaScript files, and CSS files, images, etc. So my WebView then display those HTML files just fine. My problem is when I modify...
Guillaume
1

votes
5

answer
8.8k

Views

How to customize the NumberPicker

I found 2 built-in NumberPickers: http://techbooster.org/wp-content/uploads/2011/12/NumberPicker_SS_1.png By default, it's the first one, but when I add android:theme="@android:style/Theme.NoTitleBar" in AndroidManifest.xml, it becomes the second one. How can I put this line (I need it) and still ge...
Mageek
1

votes
3

answer
4.3k

Views

Backup/Restore application database and setting on Android

I want to add ability for users to backup application database and settings to SD card. Then should be able to restore all data on another device. How usually these tasks are done? I need recomendations/samples.
barbarian
1

votes
2

answer
205

Views

Add relativelayout programmatically

I have the following XML: As you can see above, there is a repeat of the same code (From ImageView to and this is just an example. I have to repeat it 41 times, instead of 3 that is shown here. Instead of using XML how do I add it programmatically (Let's say tvDate and tvReason are String arrays)?...
Si8
1

votes
3

answer
1.5k

Views

is there a limit to the number of numbers to send an SMS?

in my app, I want to send a mass SMS to a bunch of numbers, and I want to know if there is a time threshold or a size limit to the list of recipients of an SMS. all I saw in previous questions is code that no longer exists in the current builds of Android like references to SMSDispatcher and Setting...
thepoosh
1

votes
2

answer
3.8k

Views

android EditText not automatically wrapping text

I have looked all over the place and there are a ton of similar questions on this site, but I haven't found one that works and I'm wondering what I'm doing wrong. I have an EditText that I have to add programatically, it typically has only one line of text but I need it to wrap if the text is longer...
JStephen
1

votes
1

answer
854

Views

WebView trigger a function in activity.java

So I have a web application that I am loading via WebView inside my android app. How can I call a function inside my android app when a user has clicked a button on the external website? Besides running that function I also want to be able to pass variables to it. Maybe link like myapp://activity/?d...
just some guy
1

votes
2

answer
5.2k

Views

java.net.MalformedURLException: Protocol not found: but file exists

hi i've this little method: private void modifyXML() { try { String filepath = main.fileWithPath; File f = new File(filepath); if(f.exists()){ System.out.println("Exists"); } DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumen...
David
1

votes
1

answer
792

Views

Android GPS: android.location.Location what significance do latitude/longitude fractional digits have?

I'm using GPS on an android phone. In a small test app I get like up to 15 fractional digits (sorry, too lazy to count exactly) for the latitude and longitude. I know that GPS on a handheld device is not really accurate, so why are there so many fractional digits? I'm not having any code issue, just...
Kovács Imre
1

votes
1

answer
354

Views

OpenCL Java bindings for android

I am working in Java technology since 2010. So I am not use to C/C++ languages. Recently I need to use OpenCL for Java and android. There are many bindings of Java for OpenCL are available like JavaCL, oCL etc. JavaCL is based on JNA. Android does not support JNA. So is there any way to use these bi...
Adnan
1

votes
2

answer
1.2k

Views

Disable Android scrollview, but still allow taps on buttons in the scroll view

I want to be able to prevent a user from being able to scroll in my Android ScrollView, but still detect when they tap a button that is within the scroll view. I've subclassed the ScrollView class and have been fiddling around with the onInterceptTouchEvent and onTouchEvent methods, but can't seem t...
Mick Byrne
1

votes
2

answer
1.3k

Views

Display a layout as item in GridView

this image shows the layout of what i want to achieve, the black squares are images from the drawable folder, the red square is a framelayout with 2 images on top of one another. the problem is this : the red square (the framelayout) doesnt appear. See code below... public class ImageAdapter extend...
CENT1PEDE
1

votes
3

answer
271

Views

Publishing my android app to google play [closed]

How can I publish my android app to google play. Any step by step action will help me a lot
exponentialFun
1

votes
1

answer
1k

Views

android fragment crashes on resume

I know this is not a question but I've been struggling with this issue for a long time, whenever i work with fragments, when I leave the app (not destroyed, just click on home button) and I return to it after some amount of time, it gives nullpointerexception for all my variables and everything, I k...
El Jazouli
1

votes
2

answer
397

Views

User choose which Activity start first?

I need help please with User choose which Activity launch first.... I have 3 activities and settings activity, i want the user choose an activity to launch first and save. I will appreciate if anybody guide me to the right code or example... when i start an app always start with Test.class how do i...
user1710911
1

votes
3

answer
1.6k

Views

How to use single drawable for all screen resolutions in Android programming?

Android programming in eclipse, java, xml etc. I put all the drawables (images, xml files etc) in all the folders: mdpi, hdpi etc. So I have 4 copies of each file. Is this absolutely necessary ? Is there a way I can put them in a single "drawable" folder ? Or will android understand that if the fil...
mobilGelistirici
1

votes
2

answer
838

Views

How to append L to long in Java

I have this long 1383903835525 but need to append L for Java to recognize it as a long otherwise I get the 'int is too long' error So the en result will be 1383903835525L Im trying to date.getDate(1383903835525); public String getDate(long milliseconds) { setDateFormat(); return getResult(milliseco...
Francois
1

votes
2

answer
791

Views

Maintain textview height in LinearLayout

I have two TextViews in LinearLayout. Layout orientation is in horizontal. I have to maintain both Textview height as equal. But as per text length both are shown in different height. I had tried to make the same text length like below public static String padRight(String s, int n) { return String....
Karthick Ramu
1

votes
2

answer
4.7k

Views

Phonegap Build - No App Icon on Device

I have a small mobile app that was uploaded to Phonegap Build to bundle the app for different platform, I only insterested in the android bundle for now. The challenge is after uploading the app and phonegap gives the apk I install on my device, the icon to launch the app on the device is the generi...
kolexinfos
1

votes
3

answer
19.1k

Views

how to access database sqlite in android

Due to your solutions I have finished my application, I came here for last question about my current application, the database I created I am not able to access it, I read that is within the system of android so what should I do to access the database and export it ? public class DBAdapter { priv...
Utman Alami
-1

votes
4

answer
34

Views

Click Listeners to RecyclerView [duplicate]

This question already has an answer here: RecyclerView: how to catch the onClick on an ImageView? 2 answers What I am trying to accomplish is to create a listener for the ImageView inside the row of RecyclerView. This code is working already, but this is not the solution that I wanted to have, beca...
rolz
0

votes
1

answer
25

Views

Android - Notification received but no notification popup (Foreground)

My app is receiving the notification correctly but is failing to show a notification pop up with the received info (If the app is opened). N.B.: In case if the app is in the background, the notifications are displayed without any issue. My Code: I receive the notification in this method: @Override p...
SoliQuiD
0

votes
2

answer
27

Views

How to proper align three TextViews horizontally with ConstraintLayout

I'm trying to align three TextViews horizontally (as the title may suggest), but even after chaining they together and using app:layout_constrainedWidth="true" they're still being pushed out of the screen, strangely only by the left side when the middle or the last one grows large. Notice that I'm s...
Luciano Ferruzzi
0

votes
1

answer
18

Views

get the content provider uri crash in android

I have the following file path on my device file:///storage/emulated/0/DCIM/IMG_20190206_141330.jpg I am trying to get content provider for it to be able to rotate it using this method in kotlin private fun Uri.getPath(ctx: Context): String? { val projection = arrayOf(MediaStore.Images.Media.DATA) v...
3

votes
0

answer
42

Views

How to run emulator64-arm in a Docker container?

I tried to run emulator64-arm in a Docker container but it reported: $ emulator64-arm -avd t2 -no-window -no-accel -gpu off qemu: could not open disk image /home/testuser/.android/avd/t2.avd/sdcard.img: Interrupted system cal I think qemu-aarch64 should be a pure software emulator without any fancy...
Windoze
0

votes
1

answer
101

Views

java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.FileDescriptor.setInt$(int) error in Facebook Audience SDK

I have integrated Facebook audience SDK 'com.facebook.android:audience-network-sdk:5.1.0' in my project. Ad Showing properly in my device during debugging more but it crashing in the live version. Please note proguard is disable. A crash report is as per below. java.lang.NullPointerException: Attem...
Anand Savjani
0

votes
0

answer
9

Views

Google Vision API in background service?

I'm trying to use the google vision api facetracker sample ( https://github.com/googlesamples/android-vision/tree/master/visionSamples/FaceTracker ) to detect and track faces without showing the preview (at least detect, tracking is not necessary). The main problem is that if I delete the "preview"...
Gerard E

View additional questions