w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » ANDROID » Page 4
How to toggle focus between buttons without losing focus on clicking button
Every time you focus a button inside your thread, store a reference to that button in a variable accesible by your class. Then, on your button's onClickListener in addition to your program logic, request the focus to the last focused button. Not sure if it will prevent your on click from changing the image of the button and causing some glitches. If that would be the case, you can try to perform

Categories : Android

When does touching the screen outside an AlertDialog cancel the AlertDialog?
You can control it with dialog.setCanceledOnTouchOutside(true); For more information : How to dismiss the dialog with click on outside of the dialog?

Categories : Android

ViewPager inside fragment, how to retain state?
You will need to do 2 things to resolve the issue: 1) You should use onCreate method instead of onViewCreated to instantiate LfPagerAdapter; i.e.: public class MainTabFragment extends Fragment { private PagerSlidingTabStrip mSlidingTabLayout; private LfPagerAdapter adapter; private ViewPager mViewPager; @Override public void onCreate(Bundle savedInstanceState) {

Categories : Android

Detecting when a circular motion has been made - Android
You will have to code it by yourself. Have a look at this good example: http://gamedevelopment.tutsplus.com/tutorials/how-to-detect-when-an-object-has-been-circled-by-a-gesture--gamedev-336

Categories : Android

How to parse complex xml
You can use ksoap2 for Android to parse SOAP responses. Generally speaking, SOAP is a pain in the *** on Android. For general XML parsing I would recommend SimpleXML to map XML to Java classes/ objects.

Categories : Android

Error when calling dialog.show "Source not found" (Android)
you are using wrong import for support package import android.app.Fragment; you should use import android.support.v4.app.Fragment; and also for getFragmentManager() use getSupportFragmentManager() instead

Categories : Android

AltBeacon scanning iBeacon on Android
The most likely problem is that your app does not have the proper AndroidManifest.xml entries to declare the beacon scanning service. This is generally done automatically using manifest merging from the library's manifest. If you are using Eclipse, you need to turn on manifest merging as described in the library's Quick Start guide: Edit your project.properties file and add the line: manifes

Categories : Android

How to inject a custom view to a viewGroup declared in an xml at runtime?
Use ViewGroup addView() method. Also you can use ViewStub

Categories : Android

Android unity3d image path
To access a file in the assets folder of your apk: String path = getAssets() + "/texture/image.png"; iTextSharp.text.Image imageHeader = iTextSharp.text.Image.GetInstance(path); The path should be something like: file:///android_asset/texture/image.png EDIT: Can't use getAssets in Unity - Then there will not be a direct system-mounted file path for files in the assets folder. What I usually

Categories : Android

application not fit to the android virtual device
Basically, your designer and emulator are using different screen dimensions. You can change the designer to use the same screen dimensions. Currently, from your screen shot you're using the Nexus One layout. From what I can tell the emulator doesn't look like the Nexus One screen dimensions. With Android it isn't as simple as 1 layout for all dimensions, screen sizes and devices. You have to imp

Categories : Android

trying to deploy sencha app for android .Not able to figure out the error in this build
Had the same problem. The problem was with the debug.keystore file in .android folder. Go to the cordova folder of your project and in console give : cordova -d compile If you see the error info with expired file Go to C:Users(Your name).android and delete file debug.keystore.

Categories : Android

Save an image stored in the resources/drawable folder inot the gallery
Get image bitamp : Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher); Store bitamp on given path : File file = new File( Environment.getExternalStorageDirectory().toString(), "ic_launcher.png"); outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); Add this permission in AndroidManif

Categories : Android

How to add cancel button to ErrorDialog of GooglePlayServicesUtil?
No, because the GooglePlayServicesUtil method returns a Dialog and not an AlertDialog. If you want this sort of custom behaviour, you need to implement your own AlertDialog (or something similar) which handles starting an activity for result, displaying a proper error message for a given status code, etc. It would be quite a hassle to achieve - if you want cancellation just use setCanceledOnTouch

Categories : Android

.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification android
You shouldn't call in doInBackground() any method that updates the list.You should collect everything in doInBackground, return it as a result and then update the list in onPostExecute. because onPostExecute and onProgressUpdate are executed in the UI thread, while doInBackground is executed in a different Thread.

Categories : Android

How to wrap text in a TexView Android
Try to use LinearLayout for your design instead of GridLayout : <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:id="@+id/img" android:layout_width="150dp" android:layout_height="225dp" android:contentDescription="@string/imgdesc"/> <LinearLayout android:layout_width=

Categories : Android

Styling ActionMode ActionBar in Android 5.0 Lollipop (with AppCompat)
Just add these two lines to the theme: <item name="actionModeBackground">@color/theme_primary_dark</item> <item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>

Categories : Android

How can I know the startActivity intent from other application?
Have you tried using getIntent() ? Then you can do: this.getIntent().getExtras(); After that if you need new intents just override the onNewIntent function in your activity.

Categories : Android

set background screen blurr when running progressbar in android
Put ProgressBar control to your layout xml <ProgressBar android:id="@+id/progressBarDialog" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:visibility="gone" android:indetermi

Categories : Android

Injecting entity object while calling google cloud endpoint from android
The way you word your question, it seems the call is silently failing. That can't be. You must be receiving some kind of exception or log somewhere which could help you identify your issue better. You could read this article to refresh on cloud endpoint APIs and android. If you are having trouble passing an arraylist of objects from your client to the API, I would suggest checking some things:

Categories : Android

How to notify android app that web-service url is changed
You can use a different way to include URL in your app, like a configuration file or some like this, and when you need to update the url you can do this with a simple GCM (Google Cloud Messaging) message with a payload, but you need to implement GCM requests handling in your app. GCM permitt to send message without the need of a static IP

Categories : Android

Picasso OOM issue with large images
The answer to all my questions is: https://code.google.com/p/android-query/wiki/API specifically: https://code.google.com/p/android-query/wiki/ImageLoading I have found some tickets at Picasso GitHub with same issues, but unfortunatelly they were never resolved...No custom transformation could help me with Picasso since i needed to resize the image upon download. AndroidQuery handled all that,

Categories : Android

Android: animation doesn't end well
I have found that Android gets a little fussy about XML vs. programatically setting things. I tested with your method and I got alpha of 0.0 at the end when I programatically set the fill after. So whereever you intialize your animation do: animationName.setFillAfter(true); instead of having it in the XML.

Categories : Android

android NullPointerException for ResultReceiver in service
Not sure if this is going to be the issue but: intent.putExtra("receiver", resultReceiver); -------- resultReceiver = intent.getParcelableExtra("mLastID"); Your identification strings do not match, that way will never work. Hope it helps

Categories : Android

how can i create PayPalAdvancedPayment object in order to make a chained payment?
Sorry, the PayPal Android SDK does not yet support chained or parallel payments. The code snippet you pasted in the second section refers to the old MPL, which is your only option at this point. Please follow the iOS issue on when the REST APIs and PayPal mSDK will be supporting this feature.

Categories : Android

How to connect android application to MSSQL server and retrive data from it?
At last found a quiet good guideline to solve my problem. It tells me details about implementing web services and how to connect MSSQL server with Android. This is more than helpful and details are found on the correct answer . What do I need to do is, first of all, have to create an web service using .NET(C#) and then connect my android application to that web service to retrieve data from the

Categories : Android

Custom ListView not collapsing after expansion
Turns out the android:focusableInTouchMode="false" in my xml layouts wasn't working. So i did it programmatically via the ListView OnclickListener for every button with this code button.setFocusable(false); Works OK now

Categories : Android

onTextChanged vs afterTextChanged in Android - Live examples needed
here is the explanation: onTextChanged : This means when you start typing, like you want to write "sports" then this will call on each and every character, like it will call when you pressed "s" then again "p" then "o" and so on... afterTextChanged : This will call when you stop typing, it will calls after you completely wrote "sport", that is the main diffrence. YOUR_EDIT_TEXT.addTextChangedLi

Categories : Android

Get installed application details programatically for opening a pdf
http://pilcrowpipe.blogspot.it/2012/01/creating-custom-android-intent-chooser.html suggests that using PackageManager.queryIntentActivities() could work.

Categories : Android

Layout Android off-screen
Add your layout inside a scrollview http://developer.android.com/reference/android/widget/ScrollView.html Check this sample application for details: http://examples.javacodegeeks.com/android/core/ui/scrollview/android-scrollview-example/

Categories : Android

Android 5.0 Back icon parent activity
In yours onCreate try calling getSupportActionBar().setDisplayHomeAsUpEnabled(true); You then handle the click by checking android.R.id.home in onOptionsItemSelected

Categories : Android

Remove and Add page from PageViewer
Use this concepts. List<String> list = new ArrayList<String>(); CustomAdapoter adaptor = new CustomAdapoter(List<String> lis, ...); pager.setAdapter(adapter); public void addaPage(String str){ list.add("1"); adaptor.notifyDataSetChanged(); } public void removePage(String str) { list.remove("1"); adaptor.notifyDataSetChanged(); }

Categories : Android

ScrollView blocking its parents click listener
Can you please try adding the following touch listener for the TextView and after that, set the onclick Listener for the Textview rather than giving it to the Relative Layout. private OnTouchListener textViewTouchListener= new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); switch (action) { case Mo

Categories : Android

how to find the height and width of the image view when it is aligned center in android app?
You can find Image height using below code. final ImageView layout = (ImageView) findViewById(R.id.imageviews); ViewTreeObserver vto = layout.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { layout.getViewTreeObserver().removeGlobalOnLayoutListener(this); int height = layout

Categories : Android

how to display progress of number of bytes download and % of data download in android
You can do this : publishProgress("" + (int) ((total * 100) / lenghtOfFile)+ "lengthOfFile="+lengthOfFile); //You can use as a thing to split variable.Here, i used the name "lengthOfFile=" and i will get this through publish progress and split it there @Override protected void onProgressUpdate(String... values) { // TODO Auto-generated method stub super.onProgressUpdate(values); String

Categories : Android

How to show turn by turn navigation in android
https://developers.google.com/maps/documentation/directions/intro Use the directions API to return a list of directions in JSON, you can then plot these directions using Polylines. Additionally it returns the HTML instructions which gives you the wording for directions.

Categories : Android

Using sensor value inBroadcastReceiver
Broadcast receiver doesnt allow processing for more than 5 seconds and also the context is destroyed once the execution for onReceive method is over. You can actually have a receiver for proximity sensor and check telephony manager for the call state inside the onReceive method. Or you can start a service in the above receiver and register for proximity sensor there.

Categories : Android

Android: trying to show info based on what user profile has
I think what you're trying to do could be achieved using an ArrayAdapter and a custom row layout. It is well explained in this article. I'd recommend reading the whole thing but section 6 explains what you want to do.

Categories : Android

Android support library - SearchView in Toolbar does not call onSearchRequested
I had the same problem. Found one simple workaround here. Generally speaking you override method startActivity in search activity and put params to intent when action is equal to Intent.ACTION_SEARCH: @Override public void startActivity(Intent intent) { // check if search intent if (Intent.ACTION_SEARCH.equals(intent.getAction())) { intent.putExtra("KEY", "VALUE"); }

Categories : Android

Android : Parent fragment of a nested fragment
I was calling getParentFragment() in the constructor of the child fragment and thus before the child fragment was fully created. Shifting getParentFragment() to onCreateView() solved the problem. Shifting wasn't an issue as I was calling getParentFragment() to check if the parent fragment had implemented a child fragment interaction listener.

Categories : Android




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.