Android how to refresh a service

can anyone tell me that in android how can we refresh a service?? i am developing an app in which my service is running perfectly and giving me data what i want..BUT each and every time it is giving me same data which it giving on first time i.e. service starting time. after that it is running but that data is stic with that old data ,so i want to know is there any way to refresh service so any time as data changed it give me fresh data or any other way? thanks in advance..

Android Clickable words in a TextView

I want to show some sort of "formatted" text in my activity. Some words within this TextView (for example bold formatted) should be clickable. When the user clicks on them a toast message should be displayed. Are there possibility to do that in Android? Thank you

Android Application like the one in description

I have been developing Android apps, but never did a live wallpaper. I have seen one in the market, and just confused how to do a live wallpaper like the https://market.android.com/details?id=com.anifree.anipet.aquarium How do i do? Is it that i need to learn Animations in Android? Or is there anything else. Would love if you can give me a brief overview of how to develop things as in the app i gave! Thanks Nithin

Android Splash Screen

This following code results in this output, I cant see my text view. What should I do to see my text view? It would leave this splash screen... Thanks in advance. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="hello.agam" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" /> <application android:icon="@drawable/ic_launcher" andro

Android mediaplayer with seekbar

How to use the seekbar in android mediplayer? I used the below code. seekbar working at a firstsong only then turn away from my application. mp = MediaPlayer.create(player.this, (Integer) plsong.get(i)); mp.start(); mp.setOnCompletionListener(new OnCompletionListener() { public void onCompletion(MediaPlayer player) { mp.release(); sname.setText(" "); if (j < (plsong.size() - 1)) {

How to create a grid thumbnail gallery with photo browser for Android

I've just written an app with a nice photo gallery for iOS, now I'd like to do the same thing with my Android version of the app. I see that the Android Gallery API allows me to build a scrolling gallery of images. But what I really want is an apple-photo gallery style interface with a grid of thumbnails which, when tapped, open up a full screen display of the selected image and allows me to navigate through the photo gallery using swipes or left/right arrows on a tool bar. In iOS I used th

android : not getting new outgoing call broadcast

i have defined a receiver for NEW_OUTGOING_CALL broadcast. But this is not getting invoked. In my app i have other broadcastreceivers (phone state, package change) and its all getting invoked. Please see my android manifest below I also tried changing the order of definition of receivers (put them before activities etc). manifest.xml <uses-sdk android:minSdkVersion="8" /> <!-- permissions --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> &

Android Login - sqlite problems

i am trying to use where clause to select memberid and password to verify the user credentials. but it's sayin this column doesnt exists... i tried searching the internet for various ways but no help...please help me .. here is my code public boolean memberlogin(String member_id,String password)throws SQLException{ String[] result=new String[]{member_id,password}; String whereclause="member_id=? AND password=?"; Cursor cur=sdb.query(DB_TABLE, result, whereclause, null, null, null, null); if(cur

Multitouch in android

I haved read: ACTION_DOWN is called when the user’s first finger reaches the screen. ACTION_POINTER_DOWN is called when the user touches the screen with a second, third non-primary-finger. When the user’s non primary finger leave the screen, ACTION_POINTER_UP is called. At the time when the last finger leave the screen the ACTION_UP is called. So how can I detect user’s primary finger leave the screen.

Android Make an request to HTTPS server by hitting a servlet

Here is my code to making a post request to servlet on an http server private static void post(String endpoint, Map<String, String> params) throws IOException { URL url; try { url = new URL(endpoint); } catch (MalformedURLException e) { throw new IllegalArgumentException("invalid url: " + endpoint); } StringBuilder bodyBuilder = new StringBuilder(); Iterator<Entry<String, String>> iterator = params.entrySet().iterator(); // c

Android Code requires API level 11 (current is 8)

This code gives the error "Code requires API level 11 (current is 8)". Only because these 3 lines I need to change minSdkVersion from 8 to 11. Is it possible to have minSdkVersion 8, and do something with this code - for example, execute it only if current version is at least 11? But I still want to have this functionality, and don't want to change minSdkVersion.

Using a huge data set within an Android App

So I have to save a lot of data (simple string) within the application for auto-complete purposes. Its basically a list of all UK post-codes. Since there are like a MILLION different codes, I was wondering what would be the best way to do this stuff. Putting them in a simple array is plain stupid (and impractical really). How to best approach this?

Android Async Task crashing on backbutton pressed.

What happens to an async task when the calling fragment is paused/removed? I am assuming that the task completes but it would be great of someone can just confirm that. I am trying to find a fix to my crash. I have an async task that is a recursive image loader. The image loader is an inner class of the listFragment that it loads images for. The image loader works perfectly unless i press back button before it has finished loading all the images. When i press the back button before all the ima

I am calling custom category adapter.How to set background for full screen in android when using custom adapter

I have the layout for activity like this for creating listview but it is taking only background for listitems .i want background for full. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/back" android:padding="5dp" > <ImageView android:id="@+id/logo" android:layout_width="50px" a

android How to send listview item to another activity

I am trying to send row item from list view to another activity but maybe I do something wrong. I made one app for food. And I want when the user click to "First Activity" the list item from this listview to be send to "Second Activity" and when the user click to "Add to cart" the listview item go to Cart.class But when I click to "Add to cart" the Activity is send me tо Cart.class but there have nothing. In cart.xml I have listvew. Sorry for my bad english Thanks in advance. First Activit

Android Java JNI throw Null Pointer Exception

I change the page from a C++ touch screen program and need to change the image from Android at same time. BUT when it(C++ JNI) call a java JNI, it throw "java.lang.NullPointerException" on setContentView() of JNIPage.java. Here is the code : C++ JNI : void ofAppAndroidWindow::page(int wMethod){ JNIEnv *env = ofGetJNIEnv(); if (!env) { ofLog(OF_LOG_ERROR,"Failed to get the environment using GetEnv()"); return; } jclass localClass = env->FindClass("cc/openframeworks/an

Android Images for different devices

I have a problem with my app. I had lower resolution images to load in smartphone, when I tested the app on tablet did not look good and increase the resolution of the images, but now in smartphone space memory fails and it blocked the app when I try to access a view to these images. I wanted to know how I can fix this problem and I have in the project directory 'res' images that serve to both dispositives without problem. I've heard that with suffixes drawable folders (drawable-hdpi, drawabl

Android Change actionbar background from Dialog Activity

I'm making a Activity Dialog and want to customize the layout of the Activity. I already had set in the manifest the custom style by my activity which extends "@android:style/Theme.Holo.Dialog". If I use <item name="android:windowTitleStyle">CUSTOM_STYLE_NAME</item> the only change of backgroundcolor is behind the title and not the whole actionbar. Setting <item name="android:actionBarStyle"> in my custom style didn't help either. So how can I change the background of my act

Android genymotion: "player.exe sttoped working"

I installed the package of GENYMOTION for windows(7) from their official web. It installed me the Oracle VM VirtualBox and the Genymotion. After that I opened the VirtualBox and then the Genymotion and downloaded the Galaxy Nexus-4.3-API 18-720x1280 and some others (all with API 18). Then I tried to run it but after a while appered a message saying: "player.exe stopped working". I've been a lot of time trying to make it work but I really don´t know how to fix it... Here I leave a link to my l

Android How to reuse fragment in dialog?

I want to make fragment and use it in 2 different ways for tablets and smartphones: tablet - fragment shows up as fragment dialog smartphone - fragment shows up in separate activity. I want to make class MyFragment and to use it both in activity (for smartphones) and in fragment dialogs (for tablets). Is that possible? If not, what I do wrong and how to accomplish this task?

Android Can Google GDK Glass Development Kit used with Vuzix glasses?

I have a question regarding which glasses / devices the Google Glass Development Kit supports? For our university project we just have the vuzix m100 running on andorid 4.0.3. I cant find a answer on the web, if it is possible to develop with the GDK for vuzix m100 Glass too? thanks!

InAppPurchase Android verify issue

Sorry for my English, I have a problem trying to check the status of InApp, I am following all steps listed here for the authentication: https://developers.google.com/android-publisher/authorization, I have the access_token but when I want to check the status of InApp I use this URL: https://www.googleapis.com/androidpublisher/v1.1/applications/packageName/inapp/productId/purchases/token , And the answer I get is this: 403 Forbidden   - Show headers -    {   "error": {    "errors": [     {

HTML5 Video: HLS stream has no progress bar on HTC One device running Android 4.1.2

There is no progress bar on my HTML5 HLS stream when viewing on a HTC One running Android 4.1.2. Works fine on same device running 4.4.2 here is my jsbin: http://jsbin.com/gokowovo/ Note: The stream is part of a hybrid app, to replicate you need to test in the Android default browser, works fine in Chrome. I know the progress bar has no use on the stream, it purely for aesthetics.

Android: how to set bold text in navigation drawer (indicates the current activity)

I have a navigation drawer. My problem is: I can't figure out how to set the text to bold. It's always the first item which is selected (in bold). Ps: In my ListView, I added a header. In my activity class: // Setting the nav drawer list adapter NavMainMenuAdapter adapter = new NavMainMenuAdapter(this, R.layout.list_item_mainmenu, items); drawerList.setAdapter(adapter); drawerList.setOnIte

Can anyone solve my Android Fragment issue?

I need to pass Data From Activity to fragment.here below i have attached my code.please help me This is My XML file <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <GridView android:id="@+id/grdView_products_order" android:layout_width="258dp" android:layout_height="match_parent" android:nu

Android Find nearest Color from a colors list

I have a list of colors with R,G,B values. Some of data is shown below using "Color.rgb(R,G,B)". Then I have image processing, when user touches somewhere on an image, I get an RGB value for that touched pixel. How do I search this RGB value from my colors list. Search function should be:if RGB exists in list return position or value. If RGB does not exist, return nearest value from list. My search function to is: List<Colors> colors; touchedRGB = bitmap.getPixel(x, y); for

Android Scrollinghorizontal in viewpage, action bar

I have done my android with viewpage and actionbar. It perfectly work but now i am wanting to my viewpage have horizontal scrolling now. If we disable the swiping. Can i swipe with horizontal scrollview in my fragment. . Please help!! thank you very much public class MainActivity extends FragmentActivity implements ActionBar.TabListener{ ActionBar actionbar; ViewPager viewpager; FragmentPageAdapter ft; @Override protected void onCreate(Bundle savedInstanceState) { s

Android Is it better to separate several coupled tasks into several coupled fragments instead of doing all work in one fragment?

Sorry for my English. Is it good to separate several coupled tasks [ such as loading data -> displaying data (or exception message with ability to reload data) ] into several coupled fragments ? Very often I have to do something like: do something long and get result (for example, load big data) if exception occurred, then display exception message and give the user ability to reload data (for example, simple button Reload) otherwise, display data For example, in the Google Play Store. At

NoClassDefFoundError: android.support.v7.app.ActionBarActivity

I keep getting java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegate error for the last two days and I am going to hate android, it it keeps going like this. I am really hopeless. I am adding goseamless api and I get this error just after the superOnCreate method on this line of code super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); it gives the error below while it is trying to set contentView . But if I dont add it , the ap

Android Spell Checker not switching to different language

I'm having issues with default android spell checker: it doesn't want to switch to a different language. Instead it uses default system language for spell check. Spell Checker works with default language, but when I change Locale to a different language it does not give me corrected words, but when I change language of the system Spell Checking works fine. here is my code: TextServicesManager tsm = (TextServicesManager) context.getSystemService( Context.TEXT_SERVICES_MANAGER_SE

Android Google Marker is moving while using achor in MarkerOption

I was trying to place a marker in Google Map using the following code. googleMap.clear(); //Dont know why this is 4.8f... googleMap.addMarker(new MarkerOptions() .icon(BitmapDescriptorFactory.fromResource(R.drawable.google_marker)) .position(ll).flat(true) .anchor(0.5f, 0.5f)); CameraPosition cameraPosition = new CameraPosition.Builder() .target(ll) .zoom(initMapZoom) // Sets the zoom

Android How to set the Color of the item title in navigationDrawer?

I am stuck in my own code. I can't find where to set the color of the "Title" text, in the navigationDrawer, to the defualt gray. <android.support.design.widget.NavigationView android:id="@+id/navigation_view" android:background="#000" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_gravity="start" app:headerLayout="@layout/header" app:itemTextColor="your color" app:menu="@menu/drawer" /&

Android How to synchronise separate animations in AnimationSet?

I have a mapFragment on which I am applying an animation set. The effect I am looking for is the following - "breathing" animation. The individual circles are expanding and fading doing so: The current animation code does that: That looks a bit not synchronised. Is there any way how I can achieve more synchronised effect? Current code: ... private AnimationSet breadingAnimations; @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreat

Android How to create a notification message like Whatsapp?

Here is the example case I'm curious about: let's say, 2 people chat using Whatsapp, Mike and Andy. While Mike is waiting for Andy to reply his chat, he close his chat room with Andy, and goes to another chat room, with Tom. While Mike is texting Tom, Andy is sending the reply, then, what happen in Mike's phone is a push notification appear (you got a message from Andy). But if Andy send the reply while Mike is still on the chat screen with Andy, the message won't come as a push notification,

Android Googlemaps Coded screenshot returns black image

I am trying to take a screenshot of Googlemaps after I set a market so I can use image decomposition on it and differentiate land from the ocean. But the return result I get is a black screenshot of the maps it does not take the stream here is the data My API level on the manifest.xml is 15 import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Environment; import android.os.Handler; import android.support.v4.app.FragmentActivity; import androi

Querying objectId of a pointer class in Parse.com - Android

I'm trying to retrieve the objectId as a string from my User class in Parse, but I'm getting a NullPointer. Log.w(getClass().toString(), ParseUser.getCurrentUser().getParseObject("currentGroup").getObjectId()); java.lang.NullPointerException: println needs a message I'm querying the column "currentGroup", which is a pointer to a class called "Group". All I want is to retrieve its objectId. Both the currentGroup and Group objectId columns have data. They are not null. What's going on here? E

Android Problems saving state with SharedPreferences

I am trying to save the state of a switch in SharedPreferences, but I am having trouble doing this. I have a switch for turning audio on and off. public void audio() { audio.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { if (isChecked) { player= MediaPlayer.create(legoActivity.this, R.raw.sound); player.start();

Android length=1;index=1 when trying to choose an image from the Downloads-Folder

I choose a picture using Intent iBildAuswaehlen = new Intent(Intent.ACTION_GET_CONTENT); iBildAuswaehlen.setType("image/*"); startActivityForResult(iBildAuswaehlen, ACTION_PHOTO_WAEHLEN); and I handle the result with @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == ACTION_PHOTO_WAEHLEN) { if (data == null) {

Android Authenticator with retrofit, dont just return null when a access token can not be added

the api I am working with returns a 401 for various reasons. Not just that my token has expired. Im not sure how to return that information in my call. So for example I might get a 401 becuase the user has invalid grants. im checking for this in my authenticator by @Override public Request authenticate(Route route, Response response) throws IOException {...... String reponsebody = response.body().string(); if(reponsebody!=null){ try { JS

UnsatisfiedLinkError on ANeuralNetworksModel_identifyInputsAndOutputs in NNAPI of Android 8.1 Preview

I wrote a demo of NNAPI. But The app crashes with the error "java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol 'ANeuralNetworksModel_identifyInputsAndOutputs'". After I removed the line contains ANeuralNetworksModel_identifyInputsAndOutputs(and remains other lines about NNAPI, such as ANeuralNetworksModel_addOperation and so on), the app doesn't crash anymore. My minSdkVersion, compileSdkVersion, targetSdkVersion are all 27. Is it a bug, or just my fault? Could you please hel

dlopen fails on older Android versions

I'm loading my native library like this at runtime dlopen("mylib.so", RTLD_LAZY); This works fine on recent version of android (e.g. marshmallow, nougat, etc.). However, on older versions (e.g. Jellybean), this fails with the following message in logcat Failed to load mylib.so. Error: Cannot load library: load_library[1093]: Library 'mylib.so' not found I have ensured that mylib.so is part of the apk. I have this as part of x86 and armeabi_v7a architectures. myapp.apk - lib - armeabi-v

Android Liveload is not working and no source folder on webpack

I have an IONIC 4 app and using this command: ionic capacitor run android and after that I use ionic capacitor run android -l ( for live loaded ) when I change something in VS CODE automatically compile and change in android, this is not working I don't know why, and when I go to "chrome://inspect/#devices" I see my device but I don't find any source map from my ts files, what I'm doing wrong?

Android How to navigate between a few AppContainers

how can I navigate between AppContainers? I'm detecting a correct stack in App.js const stack = User.isAuthorized() ? authStack : unauthStack; After user enter the login and password, he need switch the stack from unauthStack.SignIn to authStack.List. const unauthStack = createAppContainer(createStackNavigator({ SignIn: { screen: SignIn }, ForgotPassword: { screen: ForgotPassword }, })); const authStack = createAppContainer(createBottomTabNavigator({ List: { screen: General

Different AnimatedVectorDrawable on Marshmallow (shapeshifter animation, androidx involved)

My animation code is crashing. It's the animation created from xml: <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"> //not relevant </animated-vector> Code that runs the animation and crashes: val animationDrawable = ContextCompat.getDrawable(context, R.drawable.anim_logbook_register_measurement) val callback = object : Animatable2Compat.AnimationCallback() { override fun onAnimation

Curve imageview corner android

From last many days I am trying to implement curve corner for my view. I want to design my xml like this image: OR url: Sample Image All I want is image with curve corner. Width if image will fit its parent while height will be auto.So that full image can be display. I tried to use cardView, Glide, Picasso and com.makeramen.roundedimageview.RoundedImageView library but couldn't get proper result. adapterHome.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

  1    2   3   4   5   6  ... 下一页 最后一页 共 4045 页