[android-developers] Facebook SDK - only returning 57 results using JSON

2012-09-05 Thread Niall Paterson
Anyone experienced the Graph API returning only a set number of results 
every time when JSON is used (limit is not being implemented)

The exact problem is that 57 results are coming up and then one is coming 
up only partially, before this error is thrown.

09-05 10:09:56.911: W/System.err(3660): at 
org.json.JSON.typeMismatch(JSON.java:111)
09-05 10:09:56.911: W/System.err(3660): at 
org.json.JSONArray.init(JSONArray.java:91)
09-05 10:09:56.911: W/System.err(3660): at 
org.json.JSONArray.init(JSONArray.java:103)


My actual code is below:

String response = facebook.request(me/friends,bundle, GET);

 



   JSONArray jArray = new JSONArray(response);

   for (int i = 0;i(jArray.length());i++) {

JSONObject json_obj=jArray.getJSONObject(i);

 String username=json_obj.getString(username);

 String fbname=json_obj.getString(name);

 String installed=json_obj.getString(installed);

 Log.i(name,fbname);

 Log.i(detail, username);

 Log.i(phoneBOOL,false); 

   }


Any ideas? 

 


Anyone got experience at this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Appwidget set background and set background transparency/alpha

2011-05-20 Thread Niall
Might be helpful for people to see the code.

The preference (change as appropriate. My coding style is to have classes 
named with a lower first letter, so that has been changed from the link 
above): 
http://pastebin.com/1EkdJNnE

Preference code: 
http://pastebin.com/r5LYfF2r

Doing set colour (with android version check): 
http://pastebin.com/iyZEcSdM


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
Hi all. 

I've a quick question pertaining to remote views. 

Is it safe to keep and maintain a copy of the last RemoteViews that was used 
for updating the appwidget? I have a status message that is updated 
regularily (more so than the rest of the widget). Suppose I have something 
like... 

This updates the views (this is called before manager.updateAppWidget( 
ids[i], remoteViews ); )

  void updateAppWidgetFunction( Context context ) {
RemoteViews remoteViews = new RemoteViews( 
  context.getPackageName(),
  R.layout.main );
  
// Set all the views stuff

lastRemoteViews = remoteViews;  // lastRemoteViews is a static private 
member of the class
  }


And I have a method that updates the status message like so:

  void updateStatusMessage( String str ) {
RemoteViews remoteViews = null; 
if ( lastRemoteViews == null )
  remoteViews = remoteViewsWithIntents( context );
else
  remoteViews = lastRemoteViews; 
  
remoteViews.setTextViewText( R.id.textview_status, str );
refreshWidgetViews( context, remoteViews );
  }



Is this good practise? Or should I make a means of specialising the 
updateAppWidgetFunction to update the status message only? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
See. The problem is that I generate a table (with nested ListViews) and 
display it on the appwidget, and the elements of the table (as well as the 
buttons) have on intents tied to them when a user presses on a place of the 
table. And if the orientation of the phone changes (which isn't beyond the 
realms of possibility) with the simple update that you pasted above the 
table I generated and the intents associated will neither be shown or be 
clickable... or at least I am lead to believe they won't. 
Am I correct in this assertion? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
I should explain better. 

A user presses a refresh button (or an alarm service triggers the same 
effect) on the appwidget. I want to tell the user that the system is 
refreshing so they know the widget's doing something. But I want to tell the 
user that it's happening immediately. So I need to update the status message 
(it's always shown) and update the appwidget, and then trigger the refresh 
task which might take 10 seconds or so (downloading info from the net). 
That's really the only time I need to do what I explained. 

The best way I can think about doing it is by saving the previous 
RemoteViews that I generated when generating the table layouts. Does that 
make sense? 
I *think* it should be safe... 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
Oh wait. Do you mean that I have the thing like:

RemoteViews updateAppwidgetViews( ... ) {
  RemoteViews remoteViews = new RemoteViews( ... ); 
  
  // Set status message
  remoteViews.setTextViewText( id, refreshing ); 
  appWidgetManager.updateAppWidget( ..., remoteViews );
  
  // Do the rest of the stuff
  remoteViews( ..., ..., ... ); 
  remoteViews( ..., ..., ... ); 
  remoteViews( ..., ..., ... ); 
  remoteViews( ..., ..., ... ); 
  remoteViews( ..., ..., ... ); 
  
  // Done
  return remoteViews; 
}


Sorry. Wasn't quite with you. That's not a bad idea. Cheers!

Nope. It's 2.1 or 2.2. It's the only way I could simulate making a table on 
an appwidget... unless there's something a lot simpler that I have 
missed... 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
Remember, I want to notify the user about the fact that I'm updating the 
status of the table. So I need to first change the status message *and* then 
update the table with the new data that I parse from a website. Which 
requires two appWidgetManager.updateAppWidget calls. 
All I'm thinking is that if I keep a record of the previous full single 
remote views that was used to conjure the appwidget's layout that I could do 
this much simpler rather than having to generate layouts, intents, pending 
intents, table, background colour/alpha, text colour. It just seems a lot 
more reasonable to me... isn't it? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
Or does it really make much of a difference? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
Thanks for your thoughts and time. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget RemoteViews copy

2011-05-20 Thread Niall
I'm afraid it might take ten seconds. It depends on the connection to the 
Internet. 
Thanks for your thought, though. I used have it like that. But I migrated 
the updating to an AsyncTask because when it updated I couldn't do anything 
else I ordinarily could do (enter preferences, click on links etc). 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Appwidget set background and set background transparency/alpha

2011-05-20 Thread Niall
It's ColorPickerView. I changed it because I had something named very close 
to that. I decided it would be safest to rename it completely lest I get 
confused. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Random appwidget unresponsiveness

2011-05-19 Thread Niall
Hey,

I have an appwidget that works fine most of the time.  

Sometimes though, the buttons don't respond. When I press on them nothing 
happens. If I swipe to the left and back to the right it seems to sometimes 
fix it. Nothing gets put in logcat so I'm out of ideas about what might be 
happening. 

Can anyone help? Do you need more information? 

It sounds to me that the intents aren't set properly... but they are! I 
can't figure it out. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Appwidget set background and set background transparency/alpha

2011-05-18 Thread Niall
Hi all,

The reason I want these two things is because some people who use my 
appwidget have asked that I implement them. 

I'd like to do two things. I'd like to set the background colour of my 
appwidget. Is the only way of doing this to have a number of main widget 
layouts all of different colours. Ideally I'd like to set it 
by programatically setting it to #00ff00 or something. Is this possible? 
Or must I have a finite set of different drawable backgrounds that the user 
chooses from? Can I then set the background src wit remote views? 

I also want to set the transparancy of an appwidget according to a user 
preference. 
I did some searching, and I tried a lot of what was suggested, but haven't 
been able to make the background programatically semi-transparent. Is there 
a way of doing this? 

Thanks in advance

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget set background and set background transparency/alpha

2011-05-18 Thread Niall
Ahh. That's probably it so. I was doing it with Eclair. Cool. Thanks :) 

As you pointed out, String. Problem loading widget. 

Thanks very much. I may be back later, but I think this should do me. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget set background and set background transparency/alpha

2011-05-18 Thread Niall
Ahh. That's probably it so. I was doing it with Eclair. Cool. Thanks :) 

As you pointed out, String. Problem loading widget. 

Thanks very much. I may be back later, but I think this should do me. I 
assume you can use rgba for the setBackgroundColor, right? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Appwidget set background and set background transparency/alpha

2011-05-18 Thread Niall
Worked perfectly. Thanks very much. 

I lifted this color picker http://code.google.com/p/color-picker-view/ and 
wrapped it in a custom preference and it works delightfully :)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Does what you suggested mean that all the brunt work is performed by the 
service, and that this merely passes a RemoteViews to the appwidget for 
displaying etc?  

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
I think I understand you... but I'm not sure that I do completely. 

Having not used services for updating (or for managing updates) let me first 
ask what you mean by pushing updates so I don't misunderstand. 
Does that mean that in a service I instantiate an appWidgetManager, and then 
call its updateAppWidget with one RemoteViews? The RemoteViews coming from 
some update function I write? I think I can do that. 
And does that as a result mean that to fix the orientation issues that this 
thread's about when I get an onConfigurationChanged notification I do the 
same thing with the appWidgetManager and its updateAppWidget method? 

I think that makes sense. And that would be preferable to broadcasting from 
the service back to the appwidget? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Thanks for taking the time to explain. I think I understand it much better 
now. And I think it also makes sense, which is nice too :) 

I may come back here if I have more questions, but I think not. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Just another quick question. I want to keep track of update-to-update 
changes. So I have a ListListint variable containting my data (which 
I've parsed from the net). At the end of updating I copy this value to 
another variable. I need to keep track of these variables. Does it make more 
sense to store them in the appwidget class or the service class that I'll be 
using? I think it makes more sense for the former, but I'm still sorta 
trying to get my head around the thing so I may be wrong.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Appwidget and orientation

2011-05-05 Thread Niall
Suppose I have a status notification TextView on my appwidget. During my big 
update function (that returns the single RemoteViews object) would be be OK 
to call a method that'd update the value of the text? Like:

void updateStatus( String str ) {
  // update the status text R.id.statusUpdate 

}

RemoteViews updateAppWidgetLayout( Context context, int id ) {
  updateStatus( starting update ); 
  // do everything else
  // And here (end of function) manually set the R.id.statusUpdate view via 
the RemoteViews I'm returning.  
  return remoteViews; 

}


Where the big RemoteViews isn't touched? Or will that corrupt the process? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Appwidget and orientation

2011-05-04 Thread Niall
Hey all,

I have an appwidget that appears to break when the screen is rotated (it has 
been reported to me, and I can't test it). When I test the orientation on 
the emulator the orientation seems to work well enough... 

I have no idea how to debug this or how to figure out what to do. Does 
anyone have any advice for solving this? 

Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Appwidget and orientation

2011-05-04 Thread Niall
Found this that suggests creating an activity that detects the orientation 
change. Is that the best way to get around it? 
http://stackoverflow.com/questions/3503114/after-orientation-change-buttons-on-a-widget-are-not-responding

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Appwidget and orientation

2011-05-04 Thread Niall
Ok. I was wrong in my first post about the error not being displayed. The 
appwidget did indeed just default to the initial value. 
I solved the issue (I think) by doing the following:

public static class orientationDetectionService extends Service {
  @Override public void onStart( Intent intent, int startID ) {
  }
  @Override void onConfigurationChanged( Configuration newConfig ) {
Intent intent = new Intent( this, widget.class ); 
intent.setAction( widget.FORCE_WIDGET_REDRAW ); 
sendBroadcast( intent ); 
  }
  @Override public IBinder onBind( Intent arg0 ) { 
return null; 
  }
}


I context.startService'd in the onCreate of the widget, and put the service 
into the manifest too. 

Is this a heavy solution to the problem? It might be a naive question, but 
will this solution eat away battery? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Cookies

2011-05-02 Thread Niall
I just looked at the logcat of my app and noticed a warning I hadn't noticed 
before. 

W/ResponseProcessCookies(  575): Invalid cookie header: Set-Cookie: 
USERNAME=user; expires=Mon, 02-May-2011 12:54:51 GMT; path=/; 
domain=domain.com. Unable to parse expires attribute: Mon

Not sure what that means. Any ideas? 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Cookies

2011-05-02 Thread Niall
Thanks a lot. Got it working now. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Cookies

2011-05-01 Thread Niall
Hi all, 

I have been trying to write a widget that connects to the Internet, parses 
data and displays it. I have all the background functionality working, but I 
don't appear to be able to get the cookies that are needed to log into the 
website that provides the data to... persevere between post calls. 

I first tried writing a custom HTTP/cookie helper class, but that didn't 
work (cookies weren't displayed by the getCookies method). 
I did some searching online and I found a class on t'internet that looked 
good, and it started to keep cookies, but cookies don't appear to persevere 
between post calls. 
I fiddled around a little with the code and seem to have gotten them to 
persevere... but that appears to have broken the http request (the code 
segment that does the httpClient.execute throws an exception on the second 
call and afterwards). 

I can't seem to figure out how to make it work, and any help would be 
greatly appreciated. The code I am using is below. 
Thanks for any help.

import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.CookieStore;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.params.ClientPNames;
import org.apache.http.client.params.CookiePolicy;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext;
import android.util.Log;

public class httpHelper{
private static DefaultHttpClient httpClient = new DefaultHttpClient();
private static HttpContext localContext = new BasicHttpContext();
private static CookieStore cookieStore = new BasicCookieStore(); 
private static ListCookie cookies; 
private static HttpResponse response = null;
private static HttpPost httpPost = null;

 


public httpHelper(){
httpClient.setCookieStore( cookieStore );
}
public void clearCookies() {
httpClient.getCookieStore().clear();
}
public void abort() {
try {
if( httpClient != null )
httpPost.abort();
} catch ( Exception e ) {
}
}

public void printCookies(  ) {
if ( cookies != null ) 
 for ( int i=0; icookies.size(); i++ ) {
 Cookie cookie = cookies.get( i ); 
 Log.i( cookies, val:  + cookie );
 }
}

public HttpResponse postPage( String url, ListNameValuePair params ) 
throws UnsupportedEncodingException {
// Set up the cookie policy
httpClient.getParams().setParameter( ClientPNames.COOKIE_POLICY, 
CookiePolicy.RFC_2109 );

 // Set up the post parameters
httpPost = new HttpPost( url );
if ( params!=null  params.size()  0 ) {
UrlEncodedFormEntity ent = new UrlEncodedFormEntity( params, HTTP.UTF_8 
);
httpPost.setEntity( ent );
}
response = null;

 // Print the cookies for sanity's sake...
Log.i( httpHelper.postPage, Printing  + 
httpClient.getCookieStore().getCookies().size() +  cookies. );
printCookies();
// Attempt the connection
try {
Log.i( httpHelper.postPage, Settings cookies... ); 
if ( cookies != null )
for ( int i=0; icookies.size(); i++ )
httpClient.getCookieStore().addCookie( cookies.get(i) );

Log.i( httpHelper.postPage, Executing request... ); 
response = httpClient.execute( httpPost, localContext );
Log.i( httpHelper.postPage, Getting cookies... ); 
cookies = httpClient.getCookieStore().getCookies(); 
} catch (Exception e) {
Log.w( httpHelper.postPage, Execute threw:  + e ); 
} 

// Save this for the next iteration
cookieStore = httpClient.getCookieStore(); 
printCookies();
return response;
}
}




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Widget tables

2011-04-28 Thread Niall
I got a solution... I think. 

My widget layout is defined in a file called main.xml. In this I put in a 
vertically orientated LinearLayout ID'd as tableRowContainer.
I then added a row.xml layout definition. This only contains another linear 
layout, ID'd as tableColContainer. 
I furthermore added a col.xml layout definition that contains a TextView 
with a pre-defined text field.  

In the function that updates I then tried the following--

RemoteViews remoteViews = new RemoteViews( context.getPackageName(), 
R.layout.main );
for ( int r=0; rnumRows; r++ ) {
  RemoteViews newRow = new RemoteViews( context.getPackageName(), 
R.layout.row );
  for ( int c=0; cnumCols; c++ ) {
RemoteViews newCol = new RemoteViews( context.getPackageName(); 
r.layout.col );
newRow.addView( R.id.tableColContainer, newCol );
  }
  remoteViews.addView( r.id.tableRowContainer, newRow );
}

and my test case works as expected! 
Just need to modify it to display the real table data now. 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Android widget--table display

2011-04-28 Thread Niall
Hi all,

I have an android widget that scraps information from a website. I
want to display the data that I have gotten in a table form that's
shown on my widget, but I don't know how. I have tried the following
(but they don't appear to work)...

First I tried adding in a table in my widget, but this isn't allowed,
I think due to the limitations of RemoteViews.
The next approach was to use a TextView and importing Html and I tried
to make a table, but this isn't allowed either. I can get a table-
esque layout, but it is not satisfactory.
The third thing I tried involved making a nested list of
LinearLayout's, but this didn't work either. It was here that I found
out about the limitations of the thing.

There will always be 6 rows but there will be an indeterminate number
of columns.

I'm all out of ideas about how I might get around this problem. Does
anyone here know how I might solve this problem?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Widget tables

2011-04-28 Thread Niall
Hi all,

I'm making a widget and on it want to display some data in an NxM table or 
some sort. 
Eclipse (or rather limitations of the widget?) doesn't permit me to have a 
table layout on my widget.xml file (gives a problem loading widget) on my 
emulator. 
Are there any alternatives/workarounds for this? 

I have tried a few things that haven't worked and can't think of any 
alternatives. If I knew the size of the table it wouldn't really be an 
issue, but it is subject to change... any advice will be most welcome. 

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Activities from widget

2011-04-28 Thread Niall
I have a widget with a few buttons. 
I want one button to open preferences, and the second to start an 
AlarmManager according to the preferences that have been set. 
A click of either button on the widget will go the same activity, but I wish 
to distinguish between the clicks via extra information. And I set some 
extra information in my intent. 
Then in my activity I check for this extra information, but I can't ever 
seem to get it as not null. 
Am I doing something wrong here? 

(I can't copy over from my source directory so the code might be 
slightly erroneous)

// Setting up the intent from the widget onUpdate function
Intent intent = new Intent( context, Preferences.class ); 
intent.setAction( ACTION_WIDGET_PREFERENCES ); 
PendingIntent pendingIntent = PendingIntent.getActivity( context, 0, intent, 
0 ); 
intent.putExtra( timerSetup, false ); 
remoteViews.setOnClickPendingIntent( R.id.button_settings, pendingIntent ); 


...

// And in my onCreate of my activity:
Bundle = getIntent().getExtras(); 
try {
  if ( extras.isEmpty() )
Log.i( Preferences.onCreate, Bundle empty ); 
} catch ( Exception e ) {
  Log.w( Preferences.onCreate, extras.isEmpty() threw ); 
}


And each time I press the button isEmpty throws. 

I also tried

getIntent().getBooleanExtra( timerSetup, false ); 

and while it doesn't throw, it always seems to return the default value I 
provide (even if I pass an integer in instead). 

How can I pass data from a widget to an activity correctly? 

All advice appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Activities from widget

2011-04-28 Thread Niall
Thanks for the quick replies, you two! 
I got it working :) 

Kostya's solution seemed quickest to use so I tried that. 
I think it was the setting of the different values of the second parameter 
to getActivity that did it. Does this make sense? I had two
pendingIntent.getActivity( context, 0, intend, 0 )'s

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] SourceDataLine

2008-10-17 Thread Niall

It's been a while since I've looked at the android API, but the
javax.sound.sampled package in the latest release appears to be
missing. What happened?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---