Requests
Hey everyone,
I’ve decided to designate this page for you guys! As the number of ideas I have for potential code snippets / tutorials is finite, and what may have been a challenge for me may not have been for you and vice versa, if you would like to see an example of something posted, or would like to see a well-written and detailed tutorial on something, then please leave a request (in the form of a comment) and I’ll do my best to address it in a timely manner!
Thanks everyone! Hope to see this page filled up.
– jwei
Hey..can anybody hepl me retrieve the name no and portrait image from the local adress book and display it in ANDROID
Howabout I write a quick post on that today =D
Just check back tomorrow and I’m sure it’ll be up by then.
Hi..In ANDROID
can anybody give me the implementation to retrieve the contact name,contact no and portrait image from the local address book and display it.
Hey warrior,
Take a look at:
And see if that helps!
– jwei
Hi jwei,
Do u have any idea bout how to Enhance Contact Provider to contain Presence Status..??
Hi, is there any convenient way to display a modal style dialog? A way which is not involving threads, global event listeners etc.
Hey Dagenham,
I guess it depends on how complicated you want your dialog to be? For instance, a very simple dialog can be made following this example:
http://www.anddev.org/tutorial_modal_dialogs-t4325.html
or for more examples on the kinds of dialogs you want (custom, date picker, etc) you can see:
http://developer.android.com/guide/topics/ui/dialogs.html
However if this is something very specific that you need to do which these two links don’t help you with, then I’m all ears!
– jwei
Hi Jwei,
I tried executing the code which you have givenin the custom base adapter but got an error
‘mshow cannot be resolved”
can u help me how to figure it out..!!
thanks
Warrior
Hi Jwei,
In the custom base adapter can u give me the main code which calls the contactlistCursorAdapter.
should v extend a activity or listactivity..!!
n also can u implement the contactlistCursorAdapter such tht it retrives the user contact image also
thanks waiting for your reply..
Warrior
Hey Jwei,
Can you give me the code for opening the address book
in my application.Is that possible..??
Hey warrior,
What do you mean by “opening the address book”? Do you mean retrieving contacts?
– jwei
Hi Jwei,
Yup,meant retrieving the contacts but that is fine now:)
Have got an other issue:
I have my own customized address book application with different fields and of the the Contact Name,Contact Number are retrieved from the contact provider and there are other text views in my application.
So my issue:
1)How do i get a notify when the contents in the address book change
2) how can i maintain the consistency of my data with the data from address book
Eg: Name No Myaddress MyNotes
Abcd 123 gggg,U.S This is my note
so how do i associate my data with the data from address book
Can u give me a snippet for this?
Thanks in advance
warrior
Hi Jwei,
Got an other request..!!Hope u’l help me solve this one
Actually i can you help me out to create a Broadcaster which broadcast’s my custom string message and a broadcast receiver which recieves this message and displays that message
thank you
Why do you need a broadcast receiver? It seems like you just need to pass intents between Activities/Services in this example…
o.k what if other activites want to listen to the same broadcast..?
Hi Jwei,
Can you help me out to create a table in a database with a blob field, insert a bit map into the database and then retrieve it to my application
Hi,
my ques is
1) How do we convert a bitmap to Blob datatype ?
and now i have a table with a field for Blob data type so,
2) how do we insert the blob datatype in the table..??
Thank you
Hi Jwei,
Thanx a lot for your previous post..!!
Me back with a new request, actually i have an application and now my concern is
1) How do i create a HOME SCREEN widget (with just a icon and text below it)
2) Such that when the widget on the home screen is clicked i show up my application
would be looking forward for your help
Thank you
Hey Jwei, I was wondering if you could help me. I’ve been struggling with 2 problems for a while now, both related to the Autocomplete View that Android provides.
Firstly, I have managed to get it to successfully return Contacts, but on smaller screens (QVGA), the results are displaced to being behind the Editbox View.
Secondly, I want to be able to send an SMS to the selected Contact. But I do not know how to pass the value from the cursor to the SendSMS feature.
I have only just started out learning this stuff really, and will hopefully figure it out eventually anyway, but any help at all would be much appreciated ^^
Thanks, Carl
Hi,
I am developing the android application, through i am going to store the data on php website. I am messing with code. Can you please guide me.
Thanks & Regards,
praz
Hey Prasanna,
What exactly is the issue?
Hey Jwei,
I am trying to make it so that an activity is launched at a certain time. The Activity is basically retrieving information from the DB and carrying out a task with it. I could only find Alarm Manager to do this. Will it be able to do the job fine? Or, can the Alarm Manager perhaps hold the information that I want to work with as opposed to the DB?
Thanks, Carl
Hey Jwei,
I need to provide a kind of ‘time from now’ selection view. At the moment I’m using the ‘TimePicker’ dialog, but it has the clock at the top with the time (which I don’t want), and it’s limited to 23 hours, when I want to be limited to 99. Any ideas?
Cheers, Carl
Hey Jwei,
ive followed your post about Custom CursorAdapters.
could you add example on how to treat a case of having checkboxes in the list’s item
.
how to add listeners to it?
since this specific issue is realy buggy, i though mybe you could show some nice way how to capture a checkbox which has been checked with the support of the CursorAdapters
Thanks,
Idan.
hey hi…………i want to display devnagri letter in android………can u help me????
Ooph I’ve actually never played around with foreign languages in android…
Im trying to custom style my app (use themes). but have so far been unable to find any good example or tutorial on this subject. Could u help me in this regard?
hey hi………..i m making the “sudoku” game in android….i have the code from “hello android” book also.
but i have to do it for autogenerated grids.can u please help me?
i will be very thankful to u.
hey pranoti,
im actually in the midst of finals week (hence my absence sorry everyone)
but ive been meaning to learn about grids more so ill definitely take a stab at it during spring break!
– jwei
Is there any way that i can access the email accounts that are saved
in the default email client of android.
Basically i want to access the inbox and display their mails without
asking for username and password.
Does AccountManager class thats available in android version 2 answer
my query? and if yes then is there any alternative for v1.5 or v1.6.
Hi all…
i have problem with database…
how to
1. insert text n image to database
2. retrieve all record then show in other layout…
4. in this layout, there are two button. on button if clicked, the picture and text will change with the text an picture of the next record position.
the button else, change with the record previous…
please help me…
sory for my english
Regard.
Hey eckops,
To answer 1) you want to look at:
Specifically the onCreate() method. You’ll need to be somewhat familiar with the language SQL, but basically text is stored as a VARCHAR type typically, and images are stored as BLOB types (if this isn’t clear you’ll want to google SQL and familiarize yourself with the language)
To answer 2), to retrieve records and show as a layout you’ll want to reference
which will tell you how to write a cursor that references a database and then pulls everything out into a customizable layout.
And before I answer question 3), you’ll need to make sure you understand the steps in making 1) and 2) possible…. otherwise my answer for 3) won’t mean anything to you.
Hope this helps.
– jwei
Hi,
I want to implement an easy app which retrieves time-tables for buses from a html website.
http://busspur02.aseag.de/bs.exe?Cmd=RV&Karten=true&DatumT=8&DatumM=4&DatumJ=2010&ZeitH=&ZeitM=&Suchen=%28S%29uchen>0=&HT0=>1=&HT1=
You enter the station FROM and TO and you’ll get the next times….
How can I use the fields and return the results to the user?
Hey Jayomat,
All I can say is look carefully at what happens when you enter something in the fields on the website and click submit – does the website make a GET request? Does it make a POST request with various parameters that probably include the stations you put into the fields? Check the URL – does the URL contain the information that you want and in which case you could manually construct the URL, at which point you can use:
To get the information you want?
That’s all I can really say without basically writing your program for you. Hope this helps.
– jwei
Thank you!
Ok, I understand what you want to point out.. just one more thing… after entering the data, the site shows a page like this: hen&T1=A&HT1=Karlsgraben&DatumT=8&DatumM=4&DatumJ=2010&AbfAnk=Abf&ZeitH=21&ZeitM=15&Intervall=60&Suchen=%28S%29uchen
how do I get this data back into my app? a hint would be nice!
thank you jwei
a site like that:
http://busspur02.aseag.de/bs.exe?SID=E6D01&ScreenX=1280&ScreenY=800&CMD=CR>0=aachen&T0=A&HT0=Kaiserplatz>1=Aachen&T1=A&HT1=Karlsgraben&DatumT=8&DatumM=4&DatumJ=2010&AbfAnk=Abf&ZeitH=21&ZeitM=15&Intervall=60&Suchen=%28S%29uchen
hi……..this is pranoti again…have u done anything abt my query…..actually i tried it,bt couldnt get the solution..
hey pranoti,
what did you mean by your query? as in a SQL query? or do you mean your question about the grids from earlier?
let me know!
– jwei
hey im asking abt my previous question……..im developing sudoku in android and i want to make it autogenerated…………….i hav the source code from “hello android”book……….
plz if possible can u tell what to do………actually i tried it but couldnt get the right answer.
and i hav to submit code on 16 april……..
so plz let me know as early as passible……..
hi
jwei , firstly a big thanks for your blog
it helps many and many android developper like me . Thanks for your help toward android community
I am currently working on a project student voicemail
Is it possible to make a tutorial on how to intercept incoming calls and save them as audio file to listen them later?
thank you awkfully if you could help me because resources are lacking on the Internet
thank you very much
ps : sorry for my english^^
Hi, I was wondering if you know how to create a beep sound during a phone call? Im pretty new to this whole android thing:D
Try System.beep()? I know that’s how you create the beep sound in JAVA applications… not sure if it applies for Android though but you should look into it.
Hope this helps!
– jwei
Sry phrased it wrongly…let me rephrase…i was wondering if i can make a beep or some alert sound while the caller hears a ringing tone (initiating the call)
thanks again! 😀 really appreciate it
hi jwei,
i’m able to display a image with the contact name successfully. but user can have multiple phone numbers (Mobile,Home and Work).
it’s very easy to pick the Mobile number so my issue is how toretrieve the Home and Work phone numbers????
the other is i want to implement a local search to Contact List i have tried a lot but couldn’t figure out a way to do it properly.
so if you can give me some suggestion
regards,
Mike
hi jwei,
i have a issue on retrieving outgoing number. i’m using PhoneStateListner anyhow that’s how i want to do it.
one developer gave me a method which returns the lastCall Number. but what i need is current NUmber?? how can i get this done??
this is my code
import java.text.BreakIterator;
import com.sabretch.mobility.coloreyed.callerview1.AnimationView;
import com.sabretch.mobility.coloreyed.callerview1.outgoing.OutGoing;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.provider.BaseColumns;
import android.provider.CallLog;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
public class CallListener extends BroadcastReceiver {
private Context context;
// Intent intentttt = null;
String phonenbr;
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
this.context = context;
TelephonyManager telManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
telManager.listen(new StateListener(),
PhoneStateListener.LISTEN_CALL_STATE);
}
class StateListener extends PhoneStateListener {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
// TODO Auto-generated method stub
// super.onCallStateChanged(state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_RINGING:
Log.d(“DEBUG”, “RINGING”);
break;
case TelephonyManager.CALL_STATE_IDLE:
//BroadcastReceiver.this.clearAbortBroadcast();
//context.unregisterReceiver(this.);
System.exit(0);
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
phonenbr = getLastCallLogEntry(context);
break;
}
}
}
private String getLastCallLogEntry(Context context) {
String[] projection = new String[] { BaseColumns._ID,
CallLog.Calls.NUMBER, CallLog.Calls.TYPE };
ContentResolver resolver = context.getContentResolver();
Cursor cur = resolver.query(CallLog.Calls.CONTENT_URI, projection,
null, null, CallLog.Calls.DEFAULT_SORT_ORDER);
int numberColumn = cur.getColumnIndex(CallLog.Calls.NUMBER);
int typeColumn = cur.getColumnIndex(CallLog.Calls.TYPE);
if (!cur.moveToNext()) {
cur.close();
return “”;
}
String number = cur.getString(numberColumn);
String type = cur.getString(typeColumn);
String dir = null;
try {
int dircode = Integer.parseInt(type);
switch (dircode) {
case CallLog.Calls.OUTGOING_TYPE:
dir = “OUTGOING”;
break;
case CallLog.Calls.INCOMING_TYPE:
dir = “INCOMING”;
break;
case CallLog.Calls.MISSED_TYPE:
dir = “MISSED”;
break;
}
} catch (NumberFormatException ex) {
}
if (dir == null)
dir = “Unknown, code: ” + type;
cur.close();
return number;
}
}
Hey Mistry,
Thanks for the comment. However being a student I typically don’t have time to answer anything but just short requests / questions about my posts. So yea, for things like this which require people digging into your code I’d suggest http://www.anddev.org/index.php.
– jwei
It would be nice to see how to create a new Google Docs Spreadsheet and fill it with values through an android app the right way 😉
regards
Meex
Hm that’s an interesting idea… not sure how to do it yet but I can look into it!
Thanks Meex
– jwei
i read your Using XPATH and HTML Cleaner to parse HTML / XML and i will need more info cause am noob in this part…can you please post a very simple project for this subject?
What exactly don’t you understand?
Hello,
I saw a screenshot of your app called Facebook Sync and it seems like you overlay the status messages of buddys over the callscreen. I’m trying to do something similar (not Facebook / Sync related), but I’m not able to display something without making the callscreen unfunctional.
Any ideas?
Thanks
Tom
P.S.: I mean this screenshot: https://thinkandroid.files.wordpress.com/2009/12/ss8.png?w=200&h=300
Hey Tom,
I’ll give you a hint – think about what the only object in Android is that allows you to overlay something over ANYTHING. I’ve also actually written a post about how to do this so you can search around my blog for the article if you’d like =D
– jwei
Nice! 😀 I think I know what you mean. 😉 I’ll try it as soon as I’m at home again.
Thanks
Tom
Oh yeah! Thank you very very much! 😀 It works great! That’s exactly what I was looking for. 🙂
By the way, you’ll see your tip implemented soon into “SayMyName Dessert”. 🙂
Thanks
Tom
Argh! Not as perfect as I thought it is. 😦 I need to click this Toast, but that’s not possible. Even if I add a button to it. 😦
Any ideas?
P.S.: Sorry for the triple-post.
Hi jwei,
Is there ANY way to replace the system IME with a custom IME programmatically? I have posted a lot and searched the source code also for backdoors. Any help appreciated.
Cheers,
Earlence
I read your post on “Custom Intents and Broadcasting with Receivers” and it was a great eye opener as to how to deal with intercepting calls between applications. The main thing I’m trying to do is create a default Receiver for opening .p7b files (these are what is left when you currently try to open an s/mime encrypted email.
Ignoring all the encryption/decryption issues. I can’t for the life of me get my Receiver to actually catch the intent from the email client. I’ve even tried using a global intent-filter of just “android.intent.action.VIEW” with no other filtering, and it won’t catch it.
Are there different intents being fired when trying to open attachments from the default email client?
In my LogCat it clearly states its doing a VIEW call –
INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.VIEW dat=content://com.android.email.attachmentprovider/1/11/RAW flg=0x80001 }
Any help, or explanation on why this would be different from the other broadcasts, or why I’m misinterpreting this would be great.
P.S. I’ve tried filtering by mime type as well, with no luck. So I’m guessing it’s a different broadcast call that I don’t have access to?
Hello jwei,
I need to implement the auto-completion for youtube(video suggestions in a list as the user begins typing).
I need this feature for one of my Android activities. I am fed up googling for this topic.
Experts, please advise as to how to get these auto-completion list for youtube videos as i start typing.
This feature is there in the existing youtube application in android.
Any help in this regard is well appreciated.
Looking forward
hello to all droids. so here is my problem: i want to put on a listview the product number, the quantity and the total. note that only the product number ans quantity exists ( casue the total would be calculated).So is it possible to do that with a simplecursoradapter?
You mean you need an additional row at the end of the view with the total?
Meex
Hi,
I want some guidance.I am implementing SNMP on android Emulator. please give me some tips about its Implementation.I m using snmp4j library,But dont know how to progress with it.
Thank you in advance
Hey there. Just found this blog and its pretty awesome.
I’m struggling to write my own SimpleCursoTreeAdapter. The gist is that I want to do some custom formatting on the values I display in my child view list. The trick though is that I can’t use a viewBinder because I’m trying to support API level 4 and up and the SimpleCursorTreeAdapter only supports viewbinders from API Level 5.
I basically want to intercept where the group and child view is created and customise the display. I would give my first born for advice or help. Thanks
I am currently trying to learn Java through Eclipse so that I may develop an application for my mobile phone that will, on click, send a file from my phone’s sd card to an ip address. I don’t need to read anything back from the device that I am sending the file to, but I would like for the user to be able to configure the ip address and port. There will be 4 files, 4 buttons, and it is “as easy as that”.
I am looking for a nudge in the right direction to be able to learn how to create an activity where when the button is pressed, it will send the file specified for the respective button, and to send it to the ip address and port value designated by the application user.
I’ve used app inventor, but they do not seem to have a networking module, so I have deferred to Eclipse. Though more difficult, I am done with the interface, and now need to work on the activity of click, attatch and send.
Can you advise?
SuD
Hi jwei,
could you please help me…
1. i want to add images to a list. could u please show me a code snippet
2. A map project that shows ones current location[mine just shows grid boxes 😦 ]
hello everyone,i want to make a lockscreen soft,but i know the Home key can’t stop work by user,how about stop the Home key?
Hey..
i want to make an application just like “say caller name” in Symbian. i wanted to make it on Android. and add more features to it.
any idea how to create this application
and how to translate text to speech?
thanks
Hey Faizan,
Start with http://developer.android.com/resources/articles/tts.html – played around with this stuff a little myself but never got around to writing a blog post about it.
– jwei
Android HoneyComb is here. Could you show us how to utilize Android Host USB with a PC
<Sorry For the Duplicate, I forgot to checkbox 'notify me of followup'
How about Augmented Reality on Android? Any starting code snippets would help a lot.
Ooph good one – haven’t done anything myself on this topic but will think about it and potentially whip something up. Thanks for the suggestion.
– jwei
Hi,
I need to communicate between two android devices through wireless. I just need to send string. How can I do that?
Hey Ali,
It’s not that simple – you’ll most likely need to use some kind of socket programming to connect two phones, at which point you’re free to send strings to and from each phone. Otherwise you’ll have to rely on an external server that can issue HTTP requests to the phones. Hope that makes sense.
– jwei
Hi
I am looking to transfer data from a peer to multiple peers at the same time on Android..Is there any code snippets to which i can refer??
Thanks in advance
Any tutorial or suggestions for CursorLoader?
I’m just starting out and came across this great site!
Neat class – wasn’t aware it existed. Will keep this on the back burner for sure.
– jwei
hi guys
i want to connect app with sql server data base by static ip , i can’t find any way to do that
Hi, thanks for your articles, they have been very helpful…
I would like to know if you can help me understand some concepts. I’m new to Android, but I have worked with java a lot.
Still, I need help with the UI. Is there a guide to create UIs that can be used in different screen sizes. It have been hard to find naming conventions examples and AVD’s for large screen sizes.
How to set staic wallpaper
Hi Aj,
It’s simply with this method http://developer.android.com/reference/android/app/WallpaperManager.html#setStream%28java.io.InputStream%29
Best of luck.
– jwei
hi…can i have a remember me login function for example?
Hi Kuek,
Do you simply mean an example with a check box that says remember me? If so, this should be relatively simple.
All you would need is a check box with an onCheckListener, that if checked and submit is clicked, caches the user’s login information somewhere (i.e. through SharedPreferences or SD cards etc).
Is this what you meant / does this suffice? If you’re still confused I can definitely make a quick tutorial.
– jwei
Can you post an example of how to grant a URI read only permission to a custom content provider using an intent?
Hi Skoke,
Let me write a post on this this week =)
Thanks for the idea.
– jwei
Hey Skoke,
As promised, here it is:
Interesting topic that I didn’t know much about before this post! Hope it helps.
– jwei
Could you possibly show an example of lazy loading images into a custom cursor adapter, within a listfragment?
Hi Tim,
Correct me if I’m wrong, but programmatically isn’t a ListFragment analogous to a ListActivity?
In other words, just as how I set the ListAdapter in this example https://thinkandroid.wordpress.com/2012/06/13/lazy-loading-images-from-urls-to-listviews/ with my custom cursor adapter, you would do the same with a ListFragment.
– jwei
Hi! Thanks for all your tutorial!
May I ask if it’s possible to make a tutorial on how to implement a circle progress bar at the bottom of a listview when you scroll down to load more? Thanks!
Hi micjenks,
Sure – give me a week and I’ll whip something up. Thanks for the idea!
– jwei
Hi Jason, I am making an app in android that will pass android sensors’ data to the java server. The problem is that I am unable to pass the data over a wifi connection …. can you help me with that?
Hi Muhammad,
Sure – what seems to be the issue? How are you trying to pass it? Through an HTTP request?
– jwei
Yeah, I am trying to send it through tcp protocol. It is working well in emulator but doesn’t do anything in the real device. I don’t know what to do next.
Sent from my BlackBerry, please excuse the brevity and punctuation.
Okay – why don’t you send me a PM through email with more details on the issue (i.e. any logs that you have concerning connectivity between client/server) and I’ll see if I can help you out.
– jwei
How to PM on blog? Do you have any email I’d to let me PM on that?
Sent from my BlackBerry, please excuse the brevity and punctuation.
Yes email is lets.think.android@gmail.com
– jwei
Hey I wanted to create a custom adapter that refreshes after every sort function that I created. The sort functions takes all the entries from the database and Order By a field. But when I feed it into a baseadapter and call notifyDataSetChanged() it doesnt responds… all i get is all the items in order but the list internally is not sorted. I click on an item and it plays the previous item… Plz help asap…:(
Hi Saruabh,
Can you email me your custom adapter’s code? I can take a look. I might not be able to respond right away as I am without power thanks to Hurricane Sandy.
lets.think.android@gmail.com
– jwei
Hi,
Anyone knows how to implement ListView(with checkable items) + CustomAdapter??
If there is any tutorial which can help me please provide the same.
– PP
Hi PP,
I believe this http://pastebin.com/WjtM5msb example does exactly what you’re describing.
Hope that helps.
– jwei
“Requests Think Android” ended up being a relatively pleasant post, .
Continue authoring and I’m going to continue to keep reading! Thanks a lot ,Juliane
Hi jwei,
I’m a community blog curator for DZone. I wanted to talk with you about potentially featuring your blog on DZone’s content portals. Send me an email and I’ll share some more of the details.
Hi mitchp,
Sure, feel free to send me a PM to lets.think.android@gmail.com . Sorry for the late response – your comment got lost somewhere along the way.
– jwei
hey can anyone provide code for how to sync my calendar to mobile calender for last three months