Wednesday, 6 November 2013

Email composer show only email

Intent intent=new Intent(Intent.ACTION_SEND);
            String[] recipients={receiptId};
            intent.putExtra(Intent.EXTRA_EMAIL, recipients);
            intent.putExtra(Intent.EXTRA_SUBJECT,EmailSubject);
            intent.putExtra(Intent.EXTRA_TEXT,"");
           
            intent.setType("plain/text");
            startActivity(Intent.createChooser(intent, "Send email"));

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);

Monday, 30 September 2013

error string types not allowed (at 'configchanges' with value 'orientation screensize')

screenSize & smallestScreenSize attributes are not available in SDK 10.They are been introduced in API level 13.

Sunday, 22 September 2013

java.lang.NullPointerException in phonegap android

Its your code :-

public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);


appView.addJavascriptInterface(this, "MainActivity");
super.loadUrl(Config.getStartUrl());
}


}
Change the code :-
public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();

appView.addJavascriptInterface(this, "MainActivity");
super.loadUrl(Config.getStartUrl());
}


}

Monday, 16 September 2013

PhoneGap tutorial for beginers

http://www.javacodegeeks.com/2013/06/getting-started-with-phonegap-in-eclipse-for-android.html

Thursday, 12 September 2013

java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap in smack

This error is due to your connection is not established or your connection is disconnect
so please check whether your connection is established or not

Check the presence of user friends by smack library

where con is xmpp connection,
presenceChanged is called when any friends is going offline or online 

Roster roster = con.getRoster();
roster.addRosterListener(new RosterListener() {
    // Ignored events public void entriesAdded(Collection<String> addresses) {}
    public void entriesDeleted(Collection<String> addresses) {}
    public void entriesUpdated(Collection<String> addresses) {}
    public void presenceChanged(Presence presence) {
        System.out.println("Presence changed: " + presence.getFrom() + " " + presence);
    }
});
presence.getType() return availability and presence.getMode() return away(),busy this type of options

Wednesday, 4 September 2013

Procedure to register to sync my calender to google calender

http://samples.google-api-java-client.googlecode.com/hg/calendar-android-sample/instructions.html

Sunday, 1 September 2013

rectangle shape on editext

http://blog.vogella.com/2011/07/19/android-shapes/

     android:shape="rectangle">
     <stroke android:width="2dp" android:color="#FFFFFFFF" />
     <gradient android:startColor="#DD000000" android:endColor="#DD2ECCFA"
            android:angle="225"/>
    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>



<EditText android:layout_width="fill_parent" android:text="1"
        android:layout_height="wrap_content" android:id="@+id/editText1"
        android:inputType="numberSigned"
        android:layout_margin="5dip" android:gravity="center">
        <requestFocus></requestFocus>
    </EditText>

Monday, 19 August 2013

Step by step implementation of ndk in my app

http://software.intel.com/en-us/articles/using-the-android-x86-ndk-with-eclipse-and-porting-an-ndk-sample-app

Tuesday, 6 August 2013

LocationClient.connect() give an error for immedate requestupdate calling

LocationClient.connect() is asynchronous. You can't immediately start using the client methods until connection is complete. You should call requestLocationUpdates inside the onConnected callback (or at least after the callback has been called).

Wednesday, 17 July 2013

RenderServer::create failed to listen.it seems too many emulator instances are running on this machine. Aborting

If you have Windows Firewall (or another software firewall) active, try temporarily turning it off and then running the emulator. If that clears up the problem, then you need to teach the firewall how to open up the ports the emulator needs.

Sunday, 14 July 2013

What is an Pending intent ???

A PendingIntent is a token that you give to a foreign application (e.g. NotificationManager, AlarmManager, Home Screen AppWidgetManager, or other 3rd party applications), which allows the foreign application to use your application's permissions to execute a predefined piece of code.
If you give the foreign application an Intent, and that application sends/broadcasts the Intent you gave, they will execute the Intent with their own permissions. But if you instead give the foreign application a PendingIntent you created using your own permission, that application will execute the contained Intent using your application's permission.

Tuesday, 9 July 2013

Failed to rename directory tools to temp\ToolPackage.old01 in C:\android-sdk-windows



There are two solutions.Please it .it may help you.
1.Make a copy of the \tools folder, name it something like \copy. So you should have c:\android-sdk-windows\copy. Now run android.bat from the \copy folder with Admin privileges. This should prevent the issue with items currently being open in the \tools folder.


2.This is due to a zip folder named *tools_r21-windows* is created inside temp folder during update of your Android SDK. To remove error like that simply unzip this folder and paste inside your main Android installer folder(commonly named as android-sdk-windows).

Friday, 5 July 2013

unable to execute .dex file Multiple dex file are defined:

To resolve the problem like:-
unabletoexecute .dexfileMultipledexfilearedefined:

I pinpointed the cause of the error to /bin/classes. If I deleted the /classes dir before running the app, the app would compile and run. Of course, when I tried to actually export the app, the /classes dir would come back and along with it the error.
The solution to my problem was to install the latest version of Eclipse. When I export or run the app through the latest installation of Eclipse, the /classes folder does not appear now.

Monday, 24 June 2013

Friday, 17 May 2013

get my phone contacts android :-

Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
while (phones.moveToNext())
{
 String name=phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
 String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
 txt.append(name+ " -"+phoneNumber);




}
phones.close();



nice link to create .csv file

http://stackoverflow.com/questions/4632501/android-generate-csv-file-from-table-values