Sunday, 26 May 2013

getactionbar in fragment

I  call getactionbar in fragment but the function is not recognized. I search on Google and the solution is very simple.



ActionBar actionBar = getActivity().getActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
 
 
 
NOTE 
You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11). Remember!

how to switch between app in android

While I am using my android phone, it is not convenient to switch between app in android. I must long press a button then click on app running.
I look for an app in google play. And I finally find and choose Kakudo lite.




Some shot screens:

 

Some features:

- Swipe from the left or right to cycle through recent open apps
- Swipe from the bottom to open your Favorite Apps Drawer
- Add your most used apps/toggles to the Favorite Apps Drawer (Limited to 6)
- Choose to start on boot
- Toggles indicate whether they are on/off
- Drag and Drop to reorder/remove apps/toggles from the Favorite Apps Drawer (Android Honeycomb and Above)
- Favorite Apps Drawer ergonomically design for easier use
- Minimal RAM/CPU footprint and closes fully when turned off
- Change sensitivity and size of swipe detection areas
- Adjust Icon size to best suit your preferences
-Languages Supported:
English, Spanish, German, French, Italian, Russian, Hungarian, Chinese, Portuguese, Polish, Romanian.
You can download at: https://play.google.com/store/apps/details?id=com.acelaapps.kakudolite

 Cheer!





Friday, 24 May 2013

launch skype from android application

My android app have a button and when user click that buttons, the app will launch skype from android application.

There is 2 steps

1) Check if skype is installed.

2) launch skype.



So, I write two function:




 public static boolean IsInstallSkype(Context context)
   {
       PackageManager pm = context.getPackageManager();
       boolean app_installed = false;
       try
       {
              pm.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
              app_installed = true;
       }
       catch (PackageManager.NameNotFoundException e)
       {
              app_installed = false;
       }
       return app_installed ;
   }
// launch skype

if ((Utils.IsInstallSkype( v.getContext())))
   {
   Intent sky = new Intent("android.intent.action.VIEW");
   sky.setData(Uri.parse("skype:" + nickChat + "?chat"));
   v.getContext().startActivity(sky);
   }else
   {       
    Toast.makeText(v.getContext(),"You need to install skype", Toast.LENGTH_SHORT).show();
   }



And that 's it! happy code!
 
 

Thursday, 23 May 2013

get string resource value android

very simple
String    time = getString(R.string.just_now);

java.io.IOException: HTTP request failed, HTTP status: 500 SOAP Service

While I call web service from my android  app, I have an error.


 java.io.IOException: HTTP request failed, HTTP status: 500

 in my android app, I use ksoap lib.

I use php to test the service to know the service return true result.

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once('lib/nusoap.php');

$client = new nusoap_client('http://****.com/index.php?wsdl', true);


$result = $client->call('get_authors', array('ID' => '193'));


echo $result;
 ?>


And the service return null.

So fix again the service and the error on android app disapear. ^^