What is android raw folder in eclipse project?
This is just like assets folder, but only difference is this folder has to be accessed via R.java file. you can store any assets like MP3 or other files.
What is the maximum memory limit given for each process or application in android?
16 MB is the maximum memory limit given to any given android application. Some second generation phones will return 24 MB of memory for each process or even more.
How to send an SMS in android, through code ?
Eg: If I want to send a message to destination number "9741200300", then what is the correct code to do it?
SmsManager s = SmsManager.getDefault();
s.sendTextMessage("9741200300", null,
"Hi how are you?", null, null);
Note: first parameter is destination number, second parameter is source number which you can omit, third parameter is text to be sent, fourth parameter is sent intent, fifth parameter delivery intent.
Sent intent: You can give a pending intent that should be broad casted once your message reaches your service providers SMS center.
Delivery intent: you can give a pending intent that should be broad casted once your message is delivered to the destination phone.
What is rooting?
It is the process of allowing users of smartphones, and other android enabled devices to get the privileged permissions (root access).
rooting allows to run any appliction that requires admin level permissions in the android system And can perform any operation which is not allowed by normal android user.
rooting is also done to overcome the limitations set by carriers and OEM (original equipment manufacturers) on a phone. Rooted phone can be used any where with any carrier network.
What is the difference between permission and uses-permission in android?
i. permission tag is used to enforce a user defined permission on a component of your application.
ii. uses-permission tag is used to take a permission from the user for your application.
iii. permission tag is used when you want other applications to seek permission from the user to use some of your applications components.
How to send an email in android through code? What is the correct intent to send an email?
Intent in = new Intent(Intent.ACTION_SEND);
in.setType("message/rfc822"); //this is MIME type of email
in.putExtra(Intent.EXTRA_EMAIL, new String[]{"user@gmail.com",
"more@gmail.com"}); // to address field
in.putExtra(Intent.EXTRA_SUBJECT, "Hey imp!"); //subject of your mail
in.putExtra(Intent.EXTRA_TEXT, "WHAT ARE YOU DOING?"); //body of your email
startActivity(Intent.createChooser(in, "Select one option"));
What is the difference between this context and getapplicationcontext ?
There are two types of contexts available in android to create any component.
1. this context (or) this pointer
2. application context
When programmer wants to create any component or control, then you have to use one of the contexts.
eg: TextView t = new TextView(this);
Here we are using this pointer (context).
eg: static TextView st = new TextView(getApplicationContext());
Here we are using application context, because it is a static variable whose life time will be through out application life time.
If you use this pointer here, then it will leak memory (memory wastage) of your activity.
When to use this & getapplicationcontext:
1.If the control or variable you are creating should belong to application level then use applicationContext.
2.If the control or variable you are creating should belong to Activity level then use this pointer or this context.
Note: Generally people will think that java will not have memory leaks. But if you don't use contexts properly, then it might lead to some dangerous memory leaks in your android application.
Tip : Don't ever link between this pointer and static variables. If you follow this simple tip, you can almost reduce most of your memory leaks in your program.
what is the permission required to make a call in android, by using ACTION_CALL ?
To make calls, we should have below permission tag in manifest file after </application> tag.
<uses-permission android:name = "android.permission.CALL_PHONE"/>.
how to create customized textview in android?
TextView is a predefined UI control given by android. If you don't like or wanted to enhance its properties, then you can create your own class by extending TextView class and implementing your own functionalities.
No comments:
Post a Comment