Tag: android

android.util.Pair example

@Override public void onClick(View view) { Context context = view.getContext(); switch(view.getId()) { case R.id.getGreetingButton: Pair <Context,Integer>p=new Pair(context,1); new RestTask().execute(p); break; } } private class RestTask extends AsyncTask<Pair<Context,Integer>, Void, Pair<Context,String>> { @Override protected Pair doInBackground(Pair<Context,Integer>… p) { String text = “hello”; Pair <Context,String>result=new Pair(p.first,text); return result; } @Override protected void onPostExecute(Pair<Context,String>… p) {toaster(p.first, p.second);} } 1) […]

Android cameraSource.stop() causing app to freeze

I am building an app that has a qr scanner using the google vision api. I am having trouble stopping the camera after the qr code is read. the flow is MainActivity -> QrActivity once the qr-code received a detection the app should return to the main activity. If i do not call cameraSource.release() it […]

Notification Resume Activity

I know, there are several questions of this type but I tried all of it and it still doesn’t work. Ok, for my app; I’ve got an Activity. In this Activity, there are 4 Tabs, and the fourth one contents a list and a record button. When I am pushing record, there is a GPS […]

The count of session multiplies when I use Google Analytics Android SDK v4

As my app, the count of session was about 1,000~2,000 when I was using Google Analytics Android SDK v3. But when I updated from v3 to v4, the count of session grows to 4,000~5,000. This is the global_tracker.xml: <?xml version=”1.0″ encoding=”utf-8″?> <!– Enable automatic Activity measurement –> <bool name=”ga_autoActivityTracking”>true</bool> <!– The screen names that will […]

Unfortunately, MyApp has stopped – no error logs in logcat

Every once in a while I get: Unfortunately, MyApp has stopped. Problem is easy to solve if you have some logs, but in my case logcat has absolutely no message of error (it has normal messages published by my app and other exceptions are shown there but not this one which causes this app has […]

Is this thread safe?

I am writing an application for Android and am using worker threads to process certain information. Having read through my code I am now unsure if it is thread safe. I have written a simplified version of my code, I have omitted the Handler object used to communicate with the main thread and obviously the […]

Broadcast receiver works differently on different Version of Android (4.1.1 & 4.2.2)

I have a problem that when I run my Android App which has Broadcast Receiver for WiFi. it perform differently on different version of Android OS (Like 4.1.1 and 4.2.2). When I run it on 4.1.1 it works perfect like Broadcast receiver receive the Broad cast when Wifi state changed.(on Disconnect wifi broadcast receive I […]

Eclipse gives error when using GaussianBlur with OpenCV for Android

I posted a little part of my code, cause i keep getting a strange error that I can’t seem to get rid of. The problem can be found on this line: Imgproc.GaussianBlur(mGray, mGray, new Size (5,5), 2.2, 2); public Mat onCameraFrame(Mat inputFrame) { mGray = new Mat(); Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY); // doing a gaussian blur […]

Show PDF in Android

In my onCreate() I do this check: // // check if we have a PDF viewer, else bad things happen // Intent intent = new Intent(Intent.ACTION_VIEW); intent.setType(“application/pdf”); List<ResolveInfo> intents = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (intents == null || intents.size() == 0) { // display message then… finish(); } On my HTC Desire, this doesn’t return a […]

Integrating the app with Google search results and Chrome

The official Wikipedia app somehow does that, in my app I’m using a standard intent-filter to listen for navigation to Wikipedia urls. Is there a way to integrate with Google search? Are there any APIs available, or is this only available for the chosen ones?

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.