Howot insert icons, styling text in TextView

by Shadakshari Hiremath » Wed, 29 Apr 2009 14:26:13 GMT


Sponsored Links
 Hello Android,

I am trying to draw icon followed by styled text1 followed by styled
text2 followed by styled text3 as shown below using TextView. Text3
after wrapping should start drawing text below the icon. So, we
thought its better to insert the icon inside TextView. Style selective
text inside TextView with different size and color. Please let us know
if this is possible using TextView and methods which provide this
feature? Also let us know if there is a better way to do it.

ICON, normal italic red text, big bold blue text, small italic green text wra-
pped so that text is drawn below the ICON too.

BR,
Shaddu

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. google gdata Calender api problems with android

Hi group,
I trying to use Datepicker widget to select the date and pass to
google gdata api to fetch calender events

private DatePickerDialog.OnDateSetListener mDateSetListener =
            new DatePickerDialog.OnDateSetListener() {

                public void onDateSet(DatePicker view, int year,
                                      int monthOfYear, int dayOfMonth)
{

                    mYear = year;
                    mMonth = monthOfYear+1; // why is that step up is
needed
                    mDay = dayOfMonth;
                    updateDisplay();
                }
            };

private void updateDisplay() {

        StringBuilder status= new StringBuilder(50);
        String y1=String.valueOf(mYear);
        String m1=String.valueOf(mMonth);
        if(m1.length()==1)
        {
                m1="0"+m1;
        }
        String d1=String.valueOf(mDay);
        if(d1.length()==1)
        {
                d1="0"+d1;
        }


        String startdate=y1+"-"+m1+"-"+d1+"T"+"00:00:00";
        //example out put for startdate:2009-02-12T00:00:00
        String enddate=y1+"-"+m1+"-"+d1+"T"+"23:59:59";

        try{
                myQuery.setMinimumStartTime(DateTime.parseDateTime(startdate));
                myQuery.setMaximumStartTime(DateTime.parseDateTime(enddate));;
                Feed resultFeed = myService.query(myQuery, Feed.class);
                for (int i = 0; i < resultFeed.getEntries().size(); i++) {
                          Entry entry =  resultFeed.getEntries().get(i);
                          status.append("\t" + entry.getTitle().getPlainText());

                                                }
           }catch(Exception e){System.out.println(e);}

           mDateDisplay.setText(status);

 }

I will be glad if someone clarifies few points

1. Why is that this step up is needed - > mMonth = monthOfYear+1;
2. DateTime.parseDateTime(String args) takes date format as
2009-02-12T00:00:00 and is there any other simple approach to convert
int values from Datepicker to required format,the one shown above
doesn't work .At present i hard-code  values to make it work ,like
        
myQuery.setMinimumStartTime(DateTime.parseDateTime("2010-02-12T00:00:00"));
        
myQuery.setMaximumStartTime(DateTime.parseDateTime("2010-03-12T23:59:59"));

3. The code works fine(when i hard code the as shown above) for the
very time of execution .when i clicked back button and again tried to
run the app ,resultFeed throws Null pointer exception.

I could appreciate your valuable suggestion to correct my mistakes.

Thanks
ganesh

--

2. Service alarm/Res File - String

Hi, I'm trying to make a service sync data every *user defined
period*, having watched some of the I/O videos I've realised that the
best way to do this is via an alarm, as a result I have a couple of
questions.

I have the following method to create the alarm:

        /**
         * Set the alarm for the service to download the data periodically at
the passed interval
         */
        private void setAlarm(long interval)
        {
                AlarmManager am = (AlarmManager)
this.getSystemService(ALARM_SERVICE);
                Intent intent = new Intent(this, DownloadData.class);
                PendingIntent pendingIntent = PendingIntent.getService(this,0,
intent, 0);
                interval = interval * DateUtils.MINUTE_IN_MILLIS; //convert 
interval
from minutes to milliseconds
                long firstWake = System.currentTimeMillis() + 500;
                am.setInexactRepeating(AlarmManager.RTC_WAKEUP, firstWake, 
interval,
pendingIntent); //group updates with other system services
        }

but I'm not sure if I should put this method in the service it'self of
in Activity?

Also while I was writing this in the service class I was trying to
reference a string value in the res file but it wouldn't let me, I can
reference it via an Activity (this.getString(R.string.sync_time_min))
but when I tried this in the service eclipse kept saying it couldn't
be resolved.

Any ideas? what do I need to add to be able to reference the res file
from my service or can this not be done?

Cheers
Steve

--

3. Clear application data?

4. can't seem to stop my media player in a service..

5. Encoding mechnism in android

6. OnClickListener for Tablelayout created by a database

7. osx