Pages

Tuesday 27 November 2012

How to check heap memory and avoid out of memory exception in android

 
public static void logHeap(Class clazz) {
 
    Double allocated = new Double(Debug.getNativeHeapAllocatedSize())/new Double((1048576));
    Double available = new Double(Debug.getNativeHeapSize())/1048576.0);
    Double free = new Double(Debug.getNativeHeapFreeSize())/1048576.0);
    DecimalFormat df = new DecimalFormat();
    df.setMaximumFractionDigits(2);
    df.setMinimumFractionDigits(2);

    Log.d(APP, "debug. =================================");
    Log.d(APP, "debug.heap native: allocated " + df.format(allocated) + "MB of " + df.format(available) + "MB (" + df.format(free) + "MB free) in [" + clazz.getName().replaceAll("com.myapp.android.","") + "]");
    Log.d(APP, "debug.memory: allocated: " + df.format(new Double(Runtime.getRuntime().totalMemory()/1048576)) + "MB of " + df.format(new Double(Runtime.getRuntime().maxMemory()/1048576))+ "MB (" + df.format(new Double(Runtime.getRuntime().freeMemory()/1048576)) +"MB free)");
    System.gc();
    System.gc();

    // don't need to add the following lines, it's just an app specific handling in my app        
    if (allocated>=(new Double(Runtime.getRuntime().maxMemory())/new Double((1048576))-MEMORY_BUFFER_LIMIT_FOR_RESTART)) {
        android.os.Process.killProcess(android.os.Process.myPid());
     
         }
}

Friday 24 August 2012

Send sms in android

    Hope this will help you...:)

public void sendMessage(String text, String address) {
        String SENT = "SMS_SENT";
        String DELIVERED = "SMS_DELIVERED";

        SmsManager smsManager = SmsManager.getDefault();
        ArrayList<String> textParts = smsManager.divideMessage("message you want to send");
        registerReceiver(new BroadcastReceiver(){
            @Override
            public void onReceive(Context arg0, Intent arg1) {
                switch (getResultCode()) {
                    case Activity.RESULT_OK:
                        Toast.makeText(getBaseContext(), "Message sent successfully.", Toast.LENGTH_SHORT).show();
                        Log.i(TAG,"SMS sent");
                        break;
                    case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                        Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show();
                        Log.i(TAG,"Generic failure");
                        break;
                    case SmsManager.RESULT_ERROR_NO_SERVICE:
                        Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show();
                        Log.i(TAG,"No service");
                        break;
                    case SmsManager.RESULT_ERROR_NULL_PDU:
                        Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show();
                        Log.i(TAG,"Null PDU");
                        break;
                    case SmsManager.RESULT_ERROR_RADIO_OFF:
                        Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show();
                        Log.i(TAG,"Radio off");
                        break;
                }
            }
        }, new IntentFilter(SENT));
        ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
        for (int i = 0; i < textParts.size(); i += 1)
            sentIntents.add(PendingIntent.getBroadcast(this, i, new Intent(SENT), 0));
        if (address.length() != 0) {
            Log.i(TAG,"address=" + address);
            Log.i(TAG,"textParts=" + textParts.toString());
            try {
                smsManager.sendMultipartTextMessage(address,null,textParts,sentIntents,null);
            } catch (IllegalArgumentException e) {
                Toast.makeText(getBaseContext(), "Number invalid: " + address, Toast.LENGTH_LONG).show();
                Log.e(TAG,e.toString());
            } catch (NullPointerException e) {
                Log.e(TAG,e.toString());
            }
        }
    }

Friday 29 June 2012

How to remove android lint error in android?

Sometime we face this stupid error due to ADT  seems generate non-obsolete file.So simply remove this as using these following points.

1. Go to error log and clear this log.
2. After step.1,right click on the project and go to android tools.
3.Clear link marker and now your project without lint error.

Enjoy with your code..

Thanks
V.K.

Wednesday 30 May 2012

Failed to start monitoring in android-Solution

Hope this will help....:)

Simply follow these steps:

1. Go to DDMS Prespective.
2. Find Device and see message of device offline.
3. Find Screen Capture and in right side -> see downward arrow
4. Choose arrow and reset adb.
5. Problem Solved and enjoy......

:)

Thanks
V.k.

Thursday 24 May 2012

oDesk Profile View

Future date should not set in DatePicker dialog in android.

            int y = Integer.parseInt(String.valueOf(year));
            int m = Integer.parseInt(String.valueOf(monthOfYear+1));
            int d = Integer.parseInt(String.valueOf(dayOfMonth));
            if(y > currentYear)
            {
                Toast.makeText(SleepView.this, "Please select proper date.", Toast.LENGTH_LONG).show();
            }
            else if(m > currentMonth && y == currentYear)
            {
                Toast.makeText(SleepView.this, "Please select proper date.", Toast.LENGTH_LONG).show();
            }
            else if(d > currentDay && y == currentYear&& m == currentMonth)
            {
                Toast.makeText(SleepView.this, "Please select proper date.", Toast.LENGTH_LONG).show();
            }

Upload image on server in android.

class ImageUploadTask extends AsyncTask<Void, Void, String> {
        @Override
        protected String doInBackground(Void... unsued) {
   
            Looper.prepare();

                String pathToOurFile = getImagePath;
                String urlServer ="your url";
                String boundary =  "*****";
               

                try
                {
               
               
                    HttpClient httpClient = new DefaultHttpClient();
                    HttpContext localContext = new BasicHttpContext();
                    HttpPost httpPost = new HttpPost(urlServer);


                    MultipartEntity entittyy=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
                    Bitmap bit=bitmap;
                   
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
                    bit.compress(CompressFormat.JPEG, 100, bos);
                    byte[] data = bos.toByteArray();
                   
                    //entity.addPart("returnformat", new StringBody("json"));
                    String name=String.valueOf(System.currentTimeMillis());
                    entittyy.addPart("filedata", new ByteArrayBody(data,name+".jpg"));
                    //entity.addPart("photoCaption", new StringBody(caption.getText().toString()));
                    httpPost.setEntity(entittyy);
                    HttpResponse response = httpClient.execute(httpPost,
                            localContext);
                    BufferedReader reader = new BufferedReader(
                            new InputStreamReader(
                                    response.getEntity().getContent(), "UTF-8"));

                    String sResponse = reader.readLine();
                    Log.e("RRRRRR","Response sent---"+sResponse);
                    return sResponse;
                   
                   
                }
                catch (Exception ex)
                {
                    Log.e("--------------","end exception"+ex);
                  
                }
               
              return null;
        }

        @Override
        protected void onProgressUpdate(Void... unsued) {

        }

        @Override
        protected void onPostExecute(String sResponse) {
            try {
                if (dialog.isShowing())
                    dialog.dismiss();
                   
               
            } catch (Exception e) {
                Toast.makeText(getApplicationContext(),
                        e.getMessage(),
                        Toast.LENGTH_LONG).show();
                Log.e(e.getClass().getName(), e.getMessage(), e);
            }
        }
    }

Thursday 26 April 2012

How to calculate time difference in Android?


/**
 * @author robert.hinds
 *
 * Utility class for helper methods
 */
public class Utility {

   
    public static String getDateDifference(Date thenDate){
        Calendar now = Calendar.getInstance();
        Calendar then = Calendar.getInstance();
        now.setTime(new Date());
        then.setTime(thenDate);

       
        // Get the represented date in milliseconds
        long nowMs = now.getTimeInMillis();
        long thenMs = then.getTimeInMillis();
       
        // Calculate difference in milliseconds
        long diff = nowMs - thenMs;
       
        // Calculate difference in seconds
        long diffMinutes = diff / (60 * 1000);
        long diffHours = diff / (60 * 60 * 1000);
        long diffDays = diff / (24 * 60 * 60 * 1000);

        if (diffMinutes<60){
            if (diffMinutes==1)
                return diffMinutes + " minute ago";
            else
                return diffMinutes + " minutes ago";
        } else if (diffHours<24){
            if (diffHours==1)
                return diffHours + " hour ago";
            else
                return diffHours + " hours ago";
        }else if (diffDays<30){
            if (diffDays==1)
                return diffDays + " day ago";
            else
                return diffDays + " days ago";
        }else {
            return "a long time ago..";
        }
    }
}

Tuesday 17 April 2012

Simple function that you need pass bitmap and it will return a string..

public String BitMapToString(Bitmap bitmap){
            ByteArrayOutputStream baos=new  ByteArrayOutputStream();
            bitmap.compress(Bitmap.CompressFormat.PNG,100, baos);
            byte [] b=baos.toByteArray();
            String temp=Base64.encodeToString(b, Base64.DEFAULT);
            return temp;
      }




Reverse procedure for converting string to bitmap but string should Base64 encoding..

public Bitmap StringToBitMap(String encodedString){
     try{
       byte [] encodeByte=Base64.decode(encodedString,Base64.DEFAULT);
       Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
       return bitmap;
     }catch(Exception e){
       e.getMessage();
       return null;
     }
      }


Thanks
V.k.Hooda  

Tuesday 27 March 2012

Show Progress Dialog inside AsyncTask in Android

private class performBackgroundTask extends AsyncTask < Void, Void, Void > 
     {
        private ProgressDialog pdia;

        @Override
        protected void onPreExecute(){
           super.onPreExecute();
                pdia = new ProgressDialog(FriendList.this);
                pdia.setMessage("Loading...");
                pdia.show();   
        }

        @Override
        protected Void doInBackground(Void... params) {
            // TODO Auto-generated method stub
            asybcTastRun = new AsyncFacebookRunner(LoginActivity.facebook);
            asybcTastRun.request("me/friends", new FriendCallback());
            return null;
        }

         protected void onPostExecute(String result){
              // super.onPostExecute(result);
                    pdia.dismiss();
            }
      }

Monday 26 March 2012

Email Validation Check In Android

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Util {
   
    public static boolean isEmailValid(String email) {
        boolean isValid = false;

        String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
        CharSequence inputStr = email;

        Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(inputStr);
        if (matcher.matches()) {
            isValid = true;
        }
        return isValid;
}
}

DOM Parsing Example For Get And Post Values In Android

 Hope this will help you..:)

Here two class DOMParsingTestingActivity and XMLParser are used..

Class:DOMParsingTestingActivity

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class DOMParsingTestingActivity extends Activity
{
    String deviceid;
    String    mailing_address_value;
    String    phone_number_value;
    String first_name_value;
    String last_name_value;
    String    email_address_value;
    boolean show=false;
    String response = null; 
    String url2;
    String email_address_edit;
    String lastname_edit;
    String    phone_number_edit;
    String result1;
    String first_name_edit;
    Button savebuttton,backbton;
    EditText first_name;
    EditText last_name;
    EditText email_address;
    EditText  phone_number;
    EditText mailing_address;
    String  mailing_address_edit;
   
    String KEY_Result = "Result";
    String KEY_love_rnr = "LoveRnR";
    String xml;
    String id;
    String urlshow;
    SharedPreferences mypref;
   
   
   
    String KEY_Userdetail="UsersDetails";
    String KEY_Firstname="FirstName";
    String KEY_Lastname="LastName";
    String KEY_Emailaddress="EmailAddress";
    String KEY_Mailingaddress="MailingAddress";
    String KEY_Phonenumber="PhoneNumber";
   
    ArrayList<String> user_detail_list;
    ArrayList<String> first_name_list;
    ArrayList<String> last_name_list;
    ArrayList<String> email_address_list;
    ArrayList<String> phone_number_list;
    ArrayList<String> mailing_address_list;
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        deviceid=android.provider.Settings.System.getString(DOMParsingTestingActivity.this.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
        mypref = PreferenceManager.getDefaultSharedPreferences(this);
        first_name=(EditText)findViewById(R.id.first_nameeditbox);
        last_name=(EditText)findViewById(R.id.last_nameeditbox);
        email_address=(EditText)findViewById(R.id.email_addeditbox);
        phone_number=(EditText)findViewById(R.id.phone_number_editprofile);
        mailing_address=(EditText)findViewById(R.id.mailing_addeditbox);
        savebuttton=(Button)findViewById(R.id.savebtnid);
        backbton=(Button)findViewById(R.id.backbtnid);
        //id=mypref.getString("Userid", "");
        //static value response
        id=String.valueOf(6);
        user_detail_list=new ArrayList<String>();
        first_name_list=new ArrayList<String>();
       
       
        last_name_list=new ArrayList<String>();
        email_address_list=new ArrayList<String>();
        phone_number_list=new ArrayList<String>();
       
       
        mailing_address_list=new ArrayList<String>();
        urlshow="Enter your url /showdetails.php?user_id="+id;
        XMLParser parser=new XMLParser();   
        String xml = parser.getXmlFromUrl(urlshow);
        Log.e("SplashScreen=",""+xml);
        Document doc = parser.getDomElement(xml);
       
       
        NodeList nl = doc.getElementsByTagName(KEY_Userdetail);
        for (int i=0; i<nl.getLength();i++)
        {
        Element e = (Element) nl.item(i);
        user_detail_list.add(parser.getValue(e, KEY_Userdetail));   
        first_name_list.add(parser.getValue(e, KEY_Firstname));   
        last_name_list.add(parser.getValue(e, KEY_Lastname));
        email_address_list.add(parser.getValue(e, KEY_Emailaddress));
        phone_number_list.add(parser.getValue(e,KEY_Phonenumber));
        mailing_address_list.add(parser.getValue(e,KEY_Mailingaddress));
        first_name_value=parser.getValue(e, KEY_Firstname).toString().trim();
        last_name_value=parser.getValue(e, KEY_Lastname).toString().trim();
        email_address_value=parser.getValue(e, KEY_Emailaddress).toString().trim();
        mailing_address_value=parser.getValue(e, KEY_Mailingaddress).toString().trim();
        phone_number_value=parser.getValue(e, KEY_Phonenumber).toString().trim();
   
        first_name.setText(String.valueOf(first_name_value));
        last_name.setText(String.valueOf(last_name_value));
        email_address.setText(String.valueOf(email_address_value));
        phone_number.setText(String.valueOf(phone_number_value));
        mailing_address.setText(String.valueOf(mailing_address_value));
        Log.e("",""+first_name_value);
        Log.e("",""+last_name_value);
        }
        savebuttton.setOnClickListener(new OnClickListener()
        {
        public void onClick(View paramView)       
        {
        save();   
            }
        });
        backbton.setOnClickListener(new OnClickListener() {
           
            public void onClick(View paramView)
            {
            Intent in=new Intent(DOMParsingTestingActivity.this,DOMParsingTestingActivity.class);   
            startActivity(in);
            }
        });
        }
       public void save()
        {
       first_name_edit=first_name.getEditableText().toString().trim();
       lastname_edit=last_name.getEditableText().toString().trim();
       email_address_edit=email_address.getEditableText().toString().trim();
       phone_number_edit=phone_number.getEditableText().toString().trim();
       mailing_address_edit=mailing_address.getEditableText().toString().trim();
       if(first_name_edit.equalsIgnoreCase("")|| lastname_edit.equalsIgnoreCase("")|| email_address_edit.equalsIgnoreCase("")|| phone_number_edit.equalsIgnoreCase("")||mailing_address_edit.equalsIgnoreCase(""))
       {  
       Toast.makeText(DOMParsingTestingActivity.this,"Please enter all the fields",Toast.LENGTH_LONG).show();
       }
       else
       {
       boolean  isValidEmail = Util.isEmailValid(email_address_edit);
       boolean callMethod = true;
       if(isValidEmail == false)
        {
        callMethod = false;
        Toast.makeText(DOMParsingTestingActivity.this, "Please enter a valid email address.", Toast.LENGTH_LONG).show();
        }
       if(phone_number_edit.length()<10)
       {
           callMethod = false;
       Toast.makeText(DOMParsingTestingActivity.this, "Please enter valid phone number",Toast.LENGTH_LONG).show();
       }
        if(callMethod)
       {
       url2="Enter your url /updateuser.php?user_id="+id+"&last_name="+lastname_edit+"&first_name="+first_name_edit+"&email_address="+email_address_edit+"&phone_number="+phone_number_edit+"&mailing_address="+mailing_address_edit+"&token_id="+deviceid;
             HttpURLConnection connection;
             OutputStreamWriter request = null;
              try
               {
               URL  url = new URL(url2);
               Log.i("URL", "url is "+url.toString());
               Log.e("",""+url);
              
               connection = (HttpURLConnection) url.openConnection();
               connection.setDoOutput(true);
               connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
               connection.setRequestMethod("POST");   
               request = new OutputStreamWriter(connection.getOutputStream());
               request.write(url2);
               request.flush();
               request.close();           
               String line = "";              
               InputStreamReader isr = new InputStreamReader(connection.getInputStream());
               BufferedReader reader = new BufferedReader(isr);
               StringBuilder sb = new StringBuilder();
               while ((line = reader.readLine()) != null)
                 {
               sb.append(line + "\n");
                  }             
               response = sb.toString();         
               Log.e("ResponseRelation=",""+response);
               Toast.makeText(DOMParsingTestingActivity.this,"Saved sucessfully.",Toast.LENGTH_LONG).show();
               isr.close();
               reader.close();
                 }
              catch(IOException e)
                 {    
                 }
           }
        }
}
}

Class:XMLParser

import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import android.util.Log;

public class XMLParser
{
    String xml = null;
    Document doc = null;
    /**
     * Getting XML from URL making HTTP request
     * @param url string
     * */
    public String getXmlFromUrl(String url)
    {
        try
        {
            // defaultHttpClient
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();
            xml = EntityUtils.toString(httpEntity);

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // return XML
        return xml;
    }
   
    /**
     * Getting XML DOM element
     * @param XML string
     * */
    public Document getDomElement(String xml)
    {   
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try
        {
            DocumentBuilder db = dbf.newDocumentBuilder();
            InputSource is = new InputSource();
            is.setCharacterStream(new StringReader(xml));
                doc = db.parse(is);

            } catch (ParserConfigurationException e)
            {
                Log.e("Error: ", e.getMessage());
                return null;
            } catch (SAXException e)
            {
                Log.e("Error: ", e.getMessage());
                return null;
            } catch (IOException e)
            {
                Log.e("Error: ", e.getMessage());
                return null;
            }

            return doc;
    }
   
   
     public String getValue(Element item, String str)
     {       
            NodeList n = item.getElementsByTagName(str);       
            return this.getElementValue(n.item(0));
        }
   
     public final String getElementValue( Node elem ) {
         Node child;
         if( elem != null){
             if (elem.hasChildNodes()){
                 for( child = elem.getFirstChild(); child != null; child = child.getNextSibling() )
                 {
                     if( child.getNodeType() == Node.TEXT_NODE  )
                     {
                         return child.getNodeValue();
                     }
                 }
             }
         }
         return "";
     }
}

Friday 3 February 2012

How to change color of alternative row in listview in android?

Hope this will help you...:-)
if(postion%2==0)
            {
                convertView.setBackgroundColor(Color.parseColor("#A9BCF5"));
            }else
            {
                convertView.setBackgroundColor(Color.parseColor("#ffffff"));
            }

Thanks
V.k.Hooda

How to use listview using custom Adapter in Android?

Hope this will help you..:-)

ListView list;
protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
list = (ListView) findViewById(R.id.list);

list.setAdapter(new customadapter());
}

class customadapter extends BaseAdapter{

        public int getCount() {
            // TODO Auto-generated method stub
            return arraylist.size();
        }

        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        public View getView(int postion, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            ViewHolder holder = null;
            LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
            if (convertView == null) {
                convertView = inflater.inflate(R.layout.readsggs_row,
                        null);
                holder = new ViewHolder();
            }else
            {
              
                    holder = (ViewHolder) convertView.getTag();
              
            }
                //for (i = 0; i < DatabaseMethods.sggsbmid.size(); i++) {
            convertView.setTag(holder);
            if(postion%2==0)
            {
                convertView.setBackgroundColor(Color.parseColor("#A9BCF5"));
            }else
            {
                convertView.setBackgroundColor(Color.parseColor("#ffffff"));
            }
            holder.textview = (TextView) convertView
                        .findViewById(R.id.text);

           <///Like this text view you can use any view that you need////>

            return convertView;
        }
        class ViewHolder {
            TextView textview;
        }
    }


Thanks
V.k.Hooda

Tuesday 31 January 2012

How to change textcolor of tab text in Android

TabHost tabs = (TabHost)findViewById(R.id.TabHost01);
        tabs.setup(getLocalActivityManager());
       
       
        TabHost.TabSpec search = tabs.newTabSpec("tag1");
        search.setContent(new Intent(this,Searchgurbani.class));
        search.setIndicator("Find Me");
        tabs.addTab(search);
       
        TabHost.TabSpec pref = tabs.newTabSpec("tag5");
        pref.setContent(new Intent(this,Preferencegurbani.class));
        pref.setIndicator("Settings");
        tabs.addTab(pref);
       
        TabHost.TabSpec favorite = tabs.newTabSpec("tag6");
        favorite.setContent(new Intent(this,Favroite.class));
        favorite.setIndicator("BookMark");
        tabs.addTab(favorite);
       
        for(int i=0;i<tabs.getTabWidget().getChildCount();i++)
        {
            TextView tv = (TextView) tabs.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
            tv.setTextColor(Color.parseColor("#ffffff"));
        }

Monday 30 January 2012

Send MMS using Intent In Android

Uri mmsUri = Uri.parse("content://media/external/images/media/--"); Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra("body", "ITS FOR YOU");
intent.putExtra(Intent.EXTRA_STREAM, mmsUri); 
intent.setType("image/png"); 
startActivity(intent);