XverhelstX Well-Known Member Licensed User Longtime User Sep 25, 2011 #1 Hello everyone, This question is actually asked to Erel about the homescreen widgets. Is it possible for me to create a library that interacts with Basic4Android to extend the functions of homescreen widgets? What i mean is that I still miss some functions like setLayout on runtime, etc., that I can make with a library. Thanks, XverhelstX Sent from my SE Xperia Play using Tapatalk.
Hello everyone, This question is actually asked to Erel about the homescreen widgets. Is it possible for me to create a library that interacts with Basic4Android to extend the functions of homescreen widgets? What i mean is that I still miss some functions like setLayout on runtime, etc., that I can make with a library. Thanks, XverhelstX Sent from my SE Xperia Play using Tapatalk.
agraham Expert Licensed User Longtime User Oct 2, 2011 #21 XverhelstX said: I think the last possibility would be with remoteviews.setInt: setPadding(int, int, int, int) Click to expand... Nope. The invoked method can only accept a single int argument. setInt - Call a method taking one int on a view in the layout for this RemoteViews Click to expand... Upvote 0
XverhelstX said: I think the last possibility would be with remoteviews.setInt: setPadding(int, int, int, int) Click to expand... Nope. The invoked method can only accept a single int argument. setInt - Call a method taking one int on a view in the layout for this RemoteViews Click to expand...
XverhelstX Well-Known Member Licensed User Longtime User Oct 3, 2011 #22 Ah darn. I should have read that. Anyway, I have another question, but I don't want to make a new thread as it's fairly a small question. In java, how can I retrieve a views name using findViewByID? B4X: /** * Returns the views name. * @param view * @return */ public string findViewByID (int id) { return ba.activity.findViewById(id).tostring; } but this gives me a nullpointerexception. I'd like to return the views name using findViewById, and note that this has nothing to do with the Widget library. Thanks, XverhelstX Upvote 0
Ah darn. I should have read that. Anyway, I have another question, but I don't want to make a new thread as it's fairly a small question. In java, how can I retrieve a views name using findViewByID? B4X: /** * Returns the views name. * @param view * @return */ public string findViewByID (int id) { return ba.activity.findViewById(id).tostring; } but this gives me a nullpointerexception. I'd like to return the views name using findViewById, and note that this has nothing to do with the Widget library. Thanks, XverhelstX
agraham Expert Licensed User Longtime User Oct 3, 2011 #23 Views don't have a name, they are anonymous. Upvote 0
XverhelstX Well-Known Member Licensed User Longtime User Oct 3, 2011 #24 I see. So they work with these so called identifiers. why doesn't this work then? B4X: /** * Returns the viewID * @param view * @return */ public int getId (View view) { return view.getId(); } /** * Returns the view's height * @param view * @return */ public int getViewHeight (int id) { return ba.activity.findViewById(id).getHeight(); } The first code gives me 2, but the second gives me a java.nullpointerexception. So how can I get the views height then with the findViewByID? Thanks, Tomas Upvote 0
I see. So they work with these so called identifiers. why doesn't this work then? B4X: /** * Returns the viewID * @param view * @return */ public int getId (View view) { return view.getId(); } /** * Returns the view's height * @param view * @return */ public int getViewHeight (int id) { return ba.activity.findViewById(id).getHeight(); } The first code gives me 2, but the second gives me a java.nullpointerexception. So how can I get the views height then with the findViewByID? Thanks, Tomas
XverhelstX Well-Known Member Licensed User Longtime User Oct 3, 2011 #25 Also last question (i think), is setPadding in java the same like setLayout in Basic4Android? Thanks,; XverhelstX Upvote 0
Also last question (i think), is setPadding in java the same like setLayout in Basic4Android? Thanks,; XverhelstX
agraham Expert Licensed User Longtime User Oct 3, 2011 #26 XverhelstX said: why doesn't this work then?? Click to expand... I don't know. is setPadding in java the same like setLayout in Basic4Android? Click to expand... No. Read up on Android Views. I don't do UI stuff if I can avoid it. Upvote 0
XverhelstX said: why doesn't this work then?? Click to expand... I don't know. is setPadding in java the same like setLayout in Basic4Android? Click to expand... No. Read up on Android Views. I don't do UI stuff if I can avoid it.
XverhelstX Well-Known Member Licensed User Longtime User Oct 3, 2011 #27 Ok, nevermind. Thanks for all your replies though Agraham. I might have found it now though. Thanks, Tomas Upvote 0
Ok, nevermind. Thanks for all your replies though Agraham. I might have found it now though. Thanks, Tomas