spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » ANDROID » Page 2
Android Back navigation
Maybe this will work out:(Remember to override the onBackPressed) Intent intent = new Intent(this,A.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); Meaning of the Flag: If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed

Categories : Android

Square Dagger: Extending graph properly
I usually set Dagger up as follows: Extend Application like this: public class InjectingApplication extends Application { @Override public void onCreate() { super.onCreate(); objectGraph = ObjectGraph.create(new MainModule(this)); objectGraph = ObjectGraph.create(new SubModule1(this)); objectGraph = ObjectGraph.create(new ActivityModule()); object

Categories : Android

Android Studio - running a build collapses all the folders in the Project browser?
This is not default behavior. It does not happen in my Android Studio. Which Android studio are you using? The only time when something like this should happen is when there are bugs in the project and Android STudio navigates to each bug (opens a file containing the bug). I cannot remember of any other. Also, if you never before used Android Studio, then just double check if you maybe have som

Categories : Android

Get the location of PopupWindow
Rect rc = new Rect(); View.getWindowVisibleDisplayFrame(rc); int[] xy = new int[2]; View.getLocationInWindow(xy); rc.offset(xy[0], xy[1]); now you have inx x = rc.left, y = rc.top;

Categories : Android

error launching SDK manager in Android Studio
You must install Java 1.7, not 1.8. Check if your system is 32 or 64 bit and install appropriate Java JDK (not JRE). Before you install this you will not be able even to launch Android Studio. A few days ago Java 1.8 64bit was causing that I was unable to open Android STudio so I installed 1.7 and all started to work fine. After that, when you try to open Android Studio, it will offer you to s

Categories : Android

Is there an equivalent in iOS to the Android ProgressDialog
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; indicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0); indicator.center = self.view.center; [self.view addSubview:indicator]; [indicator bringSubviewToFront:self.view]; [UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE; Write below code wh

Categories : Android

Add multiple custom views to layout programmatically
You can inflate the layout2.xml file, edit the texts, and add it to the first layout : public class MyActivity extends Activity { private ViewGroup mLinearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout1); mLinearLayout = (ViewGroup) findViewById(R.id.linear_layout);

Categories : Android

Android App crashes after being idle for a long time
You are getting a ResourceNotFoundException because you are requesting to load a resource with an ID of 0. You are requesting to load a resource with an ID of 0 because mLayout is 0. mLayout is 0 because it is a data member of your fragment, and your fragment is being recreated, probably because your process was terminated while you were in the background. Frankly, IMHO, passing in a layout ID

Categories : Android

Phonegap capture photo and upload to server
Try this way : function getPictureFromCamera(){ navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType:Camera.DestinationType.FILE_URI }); function onSuccess(imageURI) { $('#camera-image').css({'background-image': 'url('+imageURI+')', 'background-size': '100%'}); } function onFail(message) { console.log('Failed to get an image'); }

Categories : Android

How to get Collision details of 2 objects Android
you have to use range in conditions. It may happen that your speed of moving objects is not 1. so in that case this condition never satisfy. suppose you have 2 objects then source and dest then condition will be as below: // use below condition for x if(source.x >=dest.x && source.x<=(dest.x+dest.width)) // use below condition for y if(source.y >=dest.y && source.x<

Categories : Android

Android Offline Speech Recognition to Display Only Word
ArrayList<String> text = data .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if(text.size()>0){ String firstOne=text.get(0); if(firstOne.contains(" ")){ String firstWord=firstOne.substring(0, firstOne.indexOf(' ')); txtText.setText(text.get(0)); }else{ txtText.setText(t

Categories : Android

ArrayList turn becomes when an app is resumes after onKill in android
Yes when you killed your app or finish your activity all the object created into the heap is cleaned by the garbage collector. so after killing your app or finish your activity your array list object is not available into the heap memory. so when u access it it always gives you null value. so you need to again initialized array list reference variable. to do it :- you need to store all the array

Categories : Android

How to decide screen sizes for android projects
You can use: res/layout – def res/layout-small res/layout-normal res/layout-large res/layout-xlarge Or: res/layout-sw200dp res/layout-sw600dp res/layout-sw800dp sw - smallest width You can read about this here

Categories : Android

How to merge or override the build.xml for Android in phonegap / Cordova
Try adding this to es ativeandroidant.properties: aapt.ignore.assets=<dir>node_* This file appears to be imported into build.xml (which is generated) so it provides a roundabout way of getting your value in there.

Categories : Android

Asus Zenfone 5 not detected by computer
This should solve your problem. Download the Asus USB Driver for Zenfone 5 here Extract the rar file Go to your Device Manager if you're on Windows (Make sure you've connected your phone to your computer) Choose update driver then browse the path to where the extracted rar file is. It should prompt something on your phone, just accept it Try it on your IDE, just select run configurations

Categories : Android

OutOfMemoryError when adding imageView programmatically
Use smaller images. Or, use BitmapFactory.Options, an in particular its inSampleSize option, to downsample the images to something that is more appropriate for your screen size. Or, use a third-party image-loading library, like Picasso, that can handle inSampleSize for you.

Categories : Android

Highlight ListItem when it is clicked in listview in android
listitem_selector.xml : <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/gradient_bg_hover" /> <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/gradient_bg_hover" /> <item android:state_enabled="tru

Categories : Android

How to check image sizes match between densities?
I use AndroidAssetStudio to get different resolution images , launcher icons and notification icons. Its will give you all the desired resolution images in different folders i.e (mdpi,xdpi,xxdpi etc) you just need to copy paste it in your "res" folder.

Categories : Android

Error trying send an image file with Volley?
Encode the file to a base 64 encoded string and set that in the body (just make sure your server accepts this format!). Google how to do this in java, it's everywhere params.put("uploadedfile", base64EncodedImageFile);

Categories : Android

show Imageview at distance 30% from top of the screen android
here is the code that you can use putting the image in the linear layout and then use this code LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(30, 20, 30, 0); Button okButton=new

Categories : Android

Paypal instead of in-app purchase/billing on Android and iOS
Dont know about android but your app will be rejected. According to section 11.2 of the App Store Review Guidelines for iOS (Login Required) any app that doesn't use In-App purchase will be rejected. 11.2 Apps utilizing a system other than the In App Purchase API (IAP) to purchase content, functionality, or services in an app will be rejected Additionally, note that any purchase of real world g

Categories : Android

Cannot add header view to list - setAdapter has already been called
Do not call setAdapter() until after you have called addHeaderView(). In your case, that would mean not calling addHeaderView() or setAdapter() until "after getting data from server". Or, do not use addHeaderView(), but instead modify the adapter to have an additional row, in the 0th position, after you have retrieved your server data, where the 0th position is your virtual "header".

Categories : Android

GridView delete multiple items like iphone apps uninstallation View
You'll have to make a custom gridview for that. Place a button (x) on top of the grid item and set its visibility to invisible.. onLongPress of the grid item, make that button visible.. onclick of the button, delete that grid item by getting its id. Hope I have given you a direction.

Categories : Android

Google Cloud Messaging more than 1000 notification
there is a way to resolve this situation?for example send 50 000 notification at same time No. You are welcome to divide your list into 1,000-recipient subsets, and send a GCM message to each subset.

Categories : Android

Compare current date with stored one
Here's a better solution: Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); // Date's default constructor gives you current time xmasBool = calendar.get(Calendar.MONTH) == Calendar.DECEMBER;

Categories : Android

onDiscoveryStarted Nullpointer exception
Your txtFeedback is null. Set it with findViewById on your onCreate after you call setContentView. You might want to check the xml again to check if you're using the right id on: @InjectView(R.id.txtFeedback)

Categories : Android

Android Webview detect cookie in a webpage where the content is dynamically loaded using div
The specific design you're describing is pretty hard to deal with. If you are able to control the content of the page I would suggest having the JavaScript that changes the div contents also communicate back the new state to the app (see this SO question on how to do this). If you are unable to control the content you could use WebViewClient.shouldInterceptRequest to "monitor" the requests made

Categories : Android

How to change the onPress behavior of the support toolbar menu items?
You can change the pressed state effect in your style with <item name="selectableItemBackground"> @drawable/selectable_item_background_selector </item> <item name="android:selectableItemBackground"> @drawable/selectable_item_background_selector </item> On Android 5.0 you can override the style in "style-v21" and set a ripple drawable (in

Categories : Android

AsyncTask Get Hanging
If you read this post: How do I retrieve the data from AsyncTasks doInBackground()? it looks like you have a similar circumstance. You are starting an asynchronous task, and then waiting for the result, which doesn't make sense. Instead, you should setup a callback, and use that to get the result

Categories : Android

Is it possible that phone camera shoots video with irregular fps?
I’m going to answer this question myself. First, yes, it is possible that fps or frame rate is not constant. Here is the quote from Android Developers Guide: “NOTE: On some devices that have auto-frame rate, this sets the maximum frame rate, not a constant frame rate.” http://developer.android.com/reference/android/media/MediaRecorder.html#setVideoFrameRate%28int%29 Second, there is a fu

Categories : Android

android: Is it possible to detect the app was banned on Google Play Market?
If app has Internet permission it can just bring up the app's listing page on the GP store. If not there - and if you have ability to access similar pages -then you might infer that the app was taken down.

Categories : Android

Android - How to hide menu option for current fragment
First get the item you want to remove : MenuItem item = menu.findItem(R.id.your_action); then set it's Visibility false : item.setVisible(false); and if the problem is in getting the menu (as it's not in the fragment), you can easily get a context from the activity that contains the menu and get the menu by it.

Categories : Android

Getting Contacts from user's phone
Most probably if you are using that code inside Activity than i think getActivity() is not required ,you can directly call getContentResolver() but if still doesn't work than try this to get contacts and other details . I am copying code from one of my project so hope you will understand that ArrayList<DeviceContacts> contactsList = new ArrayList<DeviceContacts>(); Cursor cur = g

Categories : Android

Android permissions in Cordova 4.0 config.xml
config.xml , is just a bunch of information. It is not executed sequentially. so if you mention you require DisallowOverscroll permission and then mention you dont require any permission, it means , <preference name="permissions" value="none" /> will not overWrite <preference name="DisallowOverscroll" value="true" /> for example: <preference name="DisallowOverscroll" val

Categories : Android

how to get background button with selector drawable in android?
try like this, Create button_selector.xml in drawable folder, <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/btn_hover" android:state_pressed="true"></item> <item android:drawable="@drawable/btn_hover" android:state_focused="true"></item>

Categories : Android

having trouble to make the layout of a dialog box
Try this: final Dialog exitBayDialog = new Dialog(getActivity()); exitBayDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); exitBayDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); exitBayDialog.setContentView(R.layout.your_dialog_layout); final EditText etSearch = (EditText) exitBayDialog.findViewById(R.id.etVehicleNumber); exitBayDialog.s

Categories : Android

how to sign out from Google Account and show account chooser again using Google Drive Android Api
Take a look at my answer in SO 21610239, specifically the UPDATE 2014-11-04 section.

Categories : Android

Animation without xml (own function)
Try this : AnimationSet animationset = new AnimationSet( true ); Animation animation= new TranslateAnimation( -100, 0, 0, 0); animation.setDuration( 700 ); animationset.addAnimation( animation); http://developer.android.com/reference/android/view/animation/AnimationSet.html

Categories : Android

Using Android Storage Access Framework and direct file access together
Make some abstraction of your operations. If you use File in many places, first replace it by some abstract class of interface such as FileSystem, providing same functionality as File, but hiding implementation details. All work with File has to be removed and placed in just one implementation of your TheFile interface, named for example NativeFileSystem. Implement all needed functions, such as o

Categories : Android


Recently Add
I'm trying to create an onListItemClick even for a customized adapter. The array of items is found in res/values folder
No navigation/status bar touch listener exists, why?
z-index in Relative layout
java.lang.SecurityException: Permission Denial: getIntentSender() when using UiAutomation in a test
mvvmcross videoview URL binding
Android Emulator Unfortunately dev tools has stopped
Square Dagger error: class is exclusively members injected / cannot be scoped required
Installing a widget from an APP
How to stop onDraw() methods causing jerky scrolling of a ListView
How to find my Google Play Services Android BASE64_PUBLIC_KEY
Set style programatically does not work
How to get contacts from phonebook and sim but skype, facebook etc. in android
Where to put JUnit test in Android project
My Android Studio project keeps running my old project/application
how to avoid OUtOfMemory problems with create Bitmap
What tools use and how do continuous integration and test in Android with eclipse?
Converting drawable resource to Bitmap Android
Fragment Transaction show() does not show fragment on second time
Espresso - How to match ActionBar visibility?
Viewport setting ignored in Phonegap Android app, but only on certain phones?
how to open an activity with url scheme android
Android AsyncTask and Thread different behavior
How can one ellicit a Toast from a Service to a Fragment
GCMIntentService onRegistered not called
LinearLayout cropping but not expanding in Scrollview
Get a file from the application directory
How to set layout params using view's on touch listener?
How to disable Google Fit and revoke permissions from the app itself
Android Wear - receiving message from Wear without WearableListenerService?
How can I start new activity from another package?
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.