Friday, 25 October 2013

authentication failure.map v2 show blank screen

Please check..
  1. check if the "libs" folder containing the "android-support-v4.jar" exists in your project.
    "android-support-v4.jar" is located in "/extras/android/compatibility/v4/android-support-v4.jar" under your "android-sdk" drectory.
  2. Before running your project, you must set your project Build target to "Google APIs", not Android x.x. version : Select your project and click Project > Properties > Project Build Target in Eclipse and select any "Google APIs ", and then run your project on your phone. If you use the emulator, also MUST set the AVD of the emulator to the any "Google APIs ".
  3. Once more, you don't need to create the new Google Maps API key in order to test your project, Just use the default provided API key, which is shown as "Key for browser apps (with referers) "in your Google APIs Console.
  4. Finally, the most important is to add Google Play services as an Android library project as follows:
    Select File > Import > Android > Existing Android Code Into Workspace and click Next. Select Browse..., enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Finish.

    Third one is really helpful me.
    Thanks

Monday, 21 October 2013

Sampling of images return null.....resolve by me

Bitmap bitmap=null;
         URL imageUrl = new URL(url);  //url from where you want to fetch data
         System.out.println(imageUrl);
         HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
         conn.setConnectTimeout(30000);
         conn.setReadTimeout(30000);
         conn.setInstanceFollowRedirects(true);
         InputStream is=conn.getInputStream();
     

 ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int len;
        while ((len = is.read(buffer)) > -1 ) {
            baos.write(buffer, 0, len);
        }
        baos.flush();

        // Open new InputStreams using the recorded bytes
        // Can be repeated as many times as you wish
        InputStream is1 = new ByteArrayInputStream(baos.toByteArray());
        InputStream is2 = new ByteArrayInputStream(baos.toByteArray());

       

         BitmapFactory.Options o = new BitmapFactory.Options();
         o.inJustDecodeBounds = true;
     
 BitmapFactory.decodeStream(is1,null,o);

         //Decode with inSampleSize
     
         int sampleSize = calculateInSampleSize(o,200, 200);
     
         System.out.println();
         o.inSampleSize=sampleSize;
         o.inJustDecodeBounds = false;
     
   
       
      bitmap=BitmapFactory.decodeStream(is2,null,o);
      System.out.println(bitmap);
     is.close();
 


The function for calculate sample factor  is

public static int calculateInSampleSize(
            BitmapFactory.Options options, int reqWidth, int reqHeight) {
   final int height = options.outHeight;
   final int width = options.outWidth;
   int inSampleSize = 1;

   if (height > reqHeight || width > reqWidth) {

       final int heightRatio = Math.round((float) height / (float) reqHeight);
       final int widthRatio = Math.round((float) width / (float) reqWidth);

       inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
   }

   return inSampleSize;
}




Sunday, 20 October 2013

Listview operation on layout

If you do not want to change shape of listitems on scrolling of listview then apply
 android:scrollingCache="false"
its work for me


2.If you do not want to change shape of item on click then apply
android:listSelector="@drawable/list_item_selector"

List_item_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_enabled="false" android:state_focused="true"
        android:drawable="@layout/transparent_bg"/>
   
    <item android:state_pressed="true"
        android:drawable="@android:color/transparent"
        />


</selector>

3. If you do not want to show scrollbars
apply
 android:scrollbars="none"










Monday, 14 October 2013

lazy list displays images only after scroll

just put
holder.image.setTag(agendas.get(position).getImageURL());
before
imageLoader.DisplayImage(agendas.get(position).getImageURL(), activity, holder.image, null);