Re: [android-developers] Re: I am getting an error uses-feature

2012-05-30 Thread Jason Teagle
Missing closing quotes ( before the / ) on the following 2 lines: 

 uses-feature android:name=android.hardware.sensors/ 
   uses-feature android:name=android.hardware.camera/  


(and 


uses-feature android:name=android.hardware.touchscreen/

above those two.) 



--
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] notifyDataSetChanged() Timing of Events on UI Thread

2012-05-30 Thread Jason Teagle
I'm subclassing BaseAdapter to simply serve up images for a GridView based 
on internal data.


The main UI allows the user to drag these images 'off' the grid. The drag 
image is a separate ImageView vying for Z order with the grid in their 
parent layout. Whenever I reposition the drag image using layout(), it 
automatically comes to the top and looks as you'd expect.


When the user first clicks the grid and I've worked out which list position 
is under the pointer, I am calling a method on the adapter to change the 
underlying data to reflect the image having 'gone' from that position. I 
thus use notifyDataSetChanged() to flag to the UI that it needs to refresh 
from the adapter.


All of this and the dragging mechanism works absolutely fine, with just one 
tiny glitch - it seems that notifyDataSetChanged() (or the GridView, which I 
assume is an observer) waits for the UI thread to become free before it 
actually refreshes the grid - which makes perfect sense. The problem is, 
that seems to bring the grid back to the top of the Z order, popping my drag 
image to the back. If you click the grid and leave the pointer in that 
position for a moment, the image appears to completely disappear until you 
move the pointer and the correct Z order is re-established with the drag 
image on top.


What is the best way to either

* Be notified that the grid was actually refreshed so that I can manually 
re-establish the Z order without waiting for pointer movement,


* Or schedule a call to bringToFront() so that it also goes on the end of 
the UI's queue, thus happening after the grid has been refreshed


I.e.,

m_overlayImage.setVisibility(View.VISIBLE); // Drag image first becomes 
visible.
m_adapter.setData(gridRowIndex, gridColIndex, 0);  == Calls 
notifyDataSetChanged().


m_overlayImage.bringToFront(); == Can I delay this until the UI thread is 
free?




* Or a third option? Is there such a thing as stay-on-top semantics for a 
view, or some sort of overlay view with transparency such as desktop Java's 
GlassPane that I could add the drag image view to instead? I can't find 
anything that looks promising in the docs... so far.


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] what if package is uninstalled while another package holds its Context?

2012-05-29 Thread Jason Teagle

(To the OP)

I may be missing something here, but why do you use a cached reference to 
package B's context?


I believe you said that trying to grab the context after B has been 
uninstalled fails, as expected - so why not use this as a test to see 
whether A should be allowed to go ahead and use those assets? Why not try 
and grab B's context afresh each time you want to access the files, and 
avoid trying to do so if the grab fails?


If it's for performance reasons, you could at least try and re-grab it every 
15 minutes - that wouldn't be such a bad hit.


Presumably if A is already using those assets while B is being uninstalled, 
you wouldn't want the code to just die - package A should at least be 
allowed to finish what it was doing; and if it is hogging those assets for a 
long period of time... that sounds like an area that could do with a little 
reconsideration as well.



--
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] back arrow

2012-05-23 Thread Jason Teagle

In my app a make button which is function to open item which has been open
before that-back button...but i whant to implement that function in button 
on

android phone...button looks like arrow...


In your the activity you launch from your first button:

@Override
public void onBackPressed()
{
   // Close this activity...
}

(requires API level 5 or higher)

or

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
   if (keyCode == KeyEvent.KEYCODE_BACK)
   {
   // Close this activity...
   return true;
   }
   return super.onKeyDown(keyCode, event);
}



--
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] Create an object class but error

2012-05-23 Thread Jason Teagle

I've create an object class but it cannot work. any mistake of my code?



private void setName() {
// TODO Auto-generated method stub
getNameText();
for (int i=0; iNUM_PLAYER; i++){
player.setPlayerName(name); // name is a String get from EditText by some 
code before

}
}



when I run the programme, it have the following error code:



05-23 09:24:35.115: E/AndroidRuntime(438): java.lang.NullPointerException
05-23 09:24:35.115: E/AndroidRuntime(438):  at hktsang56.android.mjhelper
.name_input.setName(name_input.java:81)


Which of the lines in your source code is line 81? Is it the line that says 
getNameText()? We need to see that method's definition, if that is the case, 
since I can't see any other problem (if 'name' were coming out null, then 
the error would be in setPlayerName() rather than in setName() - in fact it 
probably wouldn't generate an error in such a case).


Show us the code for getNameText(). You are possibly trying to access a 
control that you have not filled out correctly.





--
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] How to develop the screen like applications menu screen in android

2012-05-22 Thread Jason Teagle

means if more than 9 icon images the the other should include to the
next page like in applications list as grid.
can anybody suggest me to implement this


Take a look at the ViewPager class. 



--
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: How can I send an image from an sql database to an android client?

2012-05-22 Thread Jason Teagle
It does seem to decode the string into bytes(ie: not null), but the image 
that is
made from thos bytes by the bitmapfactory is null. -- 


You need to confirm that the decoded bytes at the client end match the 
original bytes at the server end. Can you manually download the image in 
question and look at its byte contents with a hex editor or something, and 
dump out the contents of the image bytes as you receive them at the client 
from the call to Base64.decode() as hex byte strings to LogCat or similar so 
you can do an ASCII / byte comparison? Not an easy thing to do, but if it's 
working up until that point you need to confirm the bytes are the same. If 
the image header has been corrupted, lost or has had an extra bit tacked 
onto the front for some strange reason then that could explain the failure 
at the BitmapFactory point.


Can you confirm you are not accidentally leaving any CRLF pairs in the 
string when decoding to bytes? Not sure if they would come from simply 
streaming the data back via HTTP (wouldn't expect it) but couldn't hurt to 
check.



--
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] Button is not actionable when i set to button background color

2012-05-21 Thread Jason Teagle

issue is in single alert box we display 16 buttons with different back
ground colors and we handling the listener for getting the  result
which button is clicked(setonclick listener) but button is not
actionable(requirement is Color selector box).


It seems unlikely that just changing its colour would make any difference. 
Try temporarily *not* changing the background colour of the buttons - do 
they now become 'actionable'?


When you say 'not actionable', what exactly do you mean? Do you mean that 
you are not going through your listener's onClick() method? How do you know 
this - have you tried using a quick Toast to prove (or disprove) you are at 
least getting *into* that method? (It may be getting into the method, but 
something goes wrong later in the method and it doesn't complete all the 
actions you are expecting).


Anything unexpected in the LogCat?

If neither of the above quick things help for testing purposes, try 
temporarily creating a new project with one activity and two buttons, set 
one's background colour to yellow and leave the other one with its normal 
colour. Add the listener to both and put a little Toast in the onClick() to 
show it gets that far. If *that* doesn't work, then post the code for that 
*test* project so we can see how you're doing things (one activity + two 
buttons should be a nice, short piece of code).


If the test project works, then it suggests something else in your main 
project is interfering and you'll have to start commenting bits out until 
you find the culprit.



--
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: Import Contacts from .vcf file in Android 2.1

2012-05-20 Thread Jason Teagle

I don't know how to use this .vcf file to import all these contacts
using code. The .vcf file contains all the details of all contacts
including photos etc.


Please try to use search engines to find what you need before asking. A 
Google search took 5 seconds:


http://en.wikipedia.org/wiki/VCard

It lists the applicable RFC files.


And the same question asked by the OP at the same time on StackOverflow:

http://stackoverflow.com/questions/4144193/import-contacts-from-vcf-file-in-android-2-1


--
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] protected static boolean

2012-05-19 Thread Jason Teagle
And that will throw me a NullPointerException.
I guess that its something simple, but maybe somebody could point me
in the right direction here?

This is the variable you have declared as the parameter: 

protected static boolean isProInstalled(Context __context__) {


This is what you then try to do with it: 

PackageManager manager = __context__.getPackageManager();
if (manager.checkSignatures(__context__.getPackageName(),


This is the value you are passing for that parameter: 

if (isProInstalled(__null__) {



What did you *expect* to happen if you try to call a method on a variable that 
now contains null? 

-- 
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: protected static boolean

2012-05-19 Thread Jason Teagle
Well the problem is that iam trying to make somthing happen that iam
not really understand (iam trying to learn)

So what i wanna do is to grabb the return true or the return
false so that i could create my if statement.

In that respect - using the static function call to grab the result for an if 
statement - you were using it correctly. 

What you must understand, though, is that in order to get through that static 
method and return an answer to you, it must execute the code within the method. 
That means that you must pass it valid data to work with (or code to *expect* 
null references as an acceptable condition), otherwise at run time it will do 
exactly what it did to you - throw an exception. 

An exception is the Java mechanism for alerting you to the fact that something 
bad happened at run time, and it exits out to the nearest catch handler it can 
as soon as possible - but not exactly gracefully (it may unwind the stack for 
you, but it won't return the value you intended - because code never gets that 
far). If you don’t explicitly add a try / catch block higher up the call chain, 
then your app will die. 

For defending against exceptions you could use a try / catch block around the 
code in your isProInstalled() method - but in your case I advise against that 
for now, as it's likely going to hide a lot of problems you will encounter 
until your understanding improves. 

If your method is asking for a context and trying to use it, ask yourself why 
you are not passing it any valid context. Can you get a valid context to pass 
to it? 

If you *want* to be able to get a quick answer without passing a valid context, 
then you need to code your method to check the context reference before you use 
it - and return an appropriate response if it is null. For example: 

protected static boolean isProInstalled(Context context) {
if (context == null) 
return false ; // No valid context - can't tell if it's installed. 
PackageManager manager = context.getPackageManager();
...

Since your method requires the context to be able to do its job, you need to 
try and get a valid context to pass to the method. 

If you are calling this code somewhere from an Activity, then the activity 
itself is a context you can pass (as ‘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

Re: [android-developers] Re: protected static boolean

2012-05-19 Thread Jason Teagle

and then it will be PackageManager manager =
this.getPackageManager();


Not quite. In a static method, there is no 'this' because the method does 
not belong to an instance of the class - but to the class as a whole. You 
will find that it won't compile.


Inside your isProInstalled() method, using 'context' was correct.


--
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] Ms health-vault api with android

2012-05-18 Thread Jason Teagle
Has anyone tried out Ms-Healthvault with android. I search it for 2 days 
and all i

got is HealthVault Java Library .
I follow all steps successfully but unable to figure how to get start with 
basic application.


Have you also followed the 'Getting Started' steps outlined here:

http://healthvaultjavalib.codeplex.com/wikipage?title=Getting%20StartedreferringTitle=Home


? It appears to include a sample app, so if you are still unable to get 
started with an app after reading how that sample does its stuff then 
perhaps it is beyond the scope of this list. I would suggest it's more of a 
support issue for the Discussion section of that site:


http://healthvaultjavalib.codeplex.com/discussions


--
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] Error in Base IceCream Sandwitch Android code.

2012-05-18 Thread Jason Teagle

I don't know whether my expected behavior is correct.


I would say it *is* correct. Consider the case where your phone is in 
someone else's hands, and a call comes in that is of a sensitive nature. 
Would you want them answering that call and pretending to be you?


Until the process of authorizing is complete, whoever has the phone - even 
you - is considered *not* the valid owner of the phone. The phone can't tell 
it's really you - Joe Bloggs could pick up your phone, type in a random pin, 
and click Forgot PIN? The fact that it is the Forgot PIN mechanism *doesn't* 
mean it's *definitely* the rightful owner using it. That's exactly the kind 
of trick a hacker would try - looking for loopholes in / during the 
validation mechanisms.



--
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] How to implement Google Drive in Android application?

2012-05-18 Thread Jason Teagle

So I am trying  Google Drive, but I did not found any suitable APIs or
example to implement.
I have gone through API documentation of Google Drive, but not able to
implement.


It seems you have to use the Document List API, as Drive is currently aimed 
at Chrome.


See:
http://stackoverflow.com/questions/10330053/google-drive-docs-api-for-android/10330497#10330497

and:
http://stackoverflow.com/questions/10306456/android-api-for-google-drive


--
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] what will be the requirement and proposal of stock brokerage apps for android

2012-05-18 Thread Jason Teagle
what will be the requirement and proposal of stock brokerage apps for 
android apps that
i have to develop the apps should have following features so pls help me in 
making of

apps requirement and proposal of the apps.


Even if this were the most appropriate group for your question, you are 
unlikely to get any help on this. If this is your project, shouldn't *you* 
be the one to work out requirements and proposals? We're not getting paid 
for being here, so we're not going to put time and effort into helping 
someone else secure / outline a project. If this is your work - or worse, an 
assignment for a study course - then at the very least you could try hitting 
your favourite search engine with terms something like how to outline 
software project requirements and proposal. You'd be surprised what a good 
search engine will turn up.



--
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] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread Jason Teagle
In my custom dialog i have a Listview , on which i am invoking 
OnItemClickListener()

but it is not detecting..
What can be the problem


Showing us the code would help... the part where you add the listener and 
how you get a reference to the list view you add it to, and the listener's 
onClick() method.


Also, please indicate how you know it isn't triggering (often people assume 
that if they don't see some activity appear, the click isn't being 
detected - but it could be the click is detected just fine, it's just that 
the activity has a fault and isn't showing).


Does your LogCat show any unusual entries - exceptions, for example?


--
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] OnItemClick not detected in listview inside customdialog

2012-05-11 Thread Jason Teagle
here it is..This is the adapter class and in it there is a click on 
holder.productName where

i am displaying the dialog..


There are a couple of questions you didn't answer:

1) How do you know it isn't getting to the click handler? Are you seeing the 
dialog appear, but not get dismissed? Are you not seeing list ID CLICKED 
in LogCat? I assume you *are* seeing the dialog appear? You have one click 
handler being added inside another click handler, but if you're seeing the 
dialog appear then it must at least be getting inside the outer handler.


2) Do you see any unusual entries in LogCat - particularly exceptions?

Curiously, if I add a button to a content view and on clicking that, have 
this code:


@Override
public void onClick(View v)
{
   final Dialog dialog = new Dialog(m_thisScreen);
   dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
   ListView lv = new ListView(m_thisScreen); // Instead of from a resource.
   dialog.setContentView(lv);
   dialog.setCancelable(true);
   final ListView customerList = lv ; // Though final might be the issue, 
but it's not.

   customerList.setOnItemClickListener(new OnItemClickListener()
   {
   @Override
   public void onItemClick(AdapterView? arg0, View arg1, int arg2, 
long arg3)

   {
   System.out.println(list ID CLICKED );
   dialog.dismiss();

   }

   } );
   customerList.setAdapter(new ArrayAdapterString(m_thisScreen, 
R.layout.list_item_layout,

   new String[] {Hello,Goodbye} ) );
   dialog.show();

}


it worked just fine :(


--
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] dynamic dialog

2012-05-11 Thread Jason Teagle

I have created dialog box dynamically
I am setting backgroung image of that dialog
but the image is not covering whole screen of dialog.


Which part of the dialog is still showing? If it's the title, then use 


dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);


--
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] dynamic dialog

2012-05-11 Thread Jason Teagle

I want to hide border of dialog.


It appears that you have to use a custom theme for the dialog - for example:

Dialog dialog = new Dialog(this, 
android.R.style.Theme_Translucent_NoTitleBar);


(I don't know how to create themes, so you'll have to search for a 
tutorial.)


The full StackOverflow article that gave this answer is here:
http://stackoverflow.com/questions/1883425/android-borderless-dialog


--
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] dynamic dialog

2012-05-11 Thread Jason Teagle

 Window window = screenDialog.getWindow();
 WindowManager.LayoutParams wlp = window.getAttributes();

  wlp.gravity = Gravity.CENTER_HORIZONTAL;

but it is not setting.


At the risk of this being a silly question... you *are* calling 
setAttributes(wlp) afterwards, yes? {:v)


*Allegedly*
(https://groups.google.com/forum/?fromgroups#!topic/android-developers/8uZYE0C4uZY)

setting the .x and .y members of wlp both to 0 centres the dialog as well. 
Worth trying to set .x to 0 if you only want horizontal centring.



--
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] Equally verticaly spaced button

2012-05-11 Thread Jason Teagle
What exactly is the problem here? You get three buttons, that equally fill 
the parent vertically.


Please try to be a little more specific about the problem - state what you 
expected, and what you got (in case it doesn't match what somebody else 
might get).



--
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] Single Activity application

2012-05-11 Thread Jason Teagle

I am reviewing code of an application that contains only one activity but
more than 12 screen
application flows with change in layout of this activity.
I need your suggestion that it is better way to work or not ??


There is one train of thought that says 'If it ain't broke, don't fix it' - 
so the question would be, is it working? If it is, don't try changing it - 
you risk breaking it.


On the other hand, it probably isn't ideal since it isn't 'the Android way' 
really - but it might save some issues regarding starting activities and 
waiting for their results, threading, persistent state during pause and 
resume, etc. There's something to be said for minimizing maintenance by 
keeping everything in the same activity.


My suggestion, therefore, is to leave it alone, unless it is specifically 
causing you some problems.



--
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] Error reports where none of the stacktrace elements relate to your code?

2012-05-11 Thread Jason Teagle
Subject: [android-developers] Error reports where none of the stacktrace 
elements

relate to your code?
For example, in the Developer Console, I got this:



Does this indicate a bug in the SDK?


Unfortunately, not necessarily. Consider a situation where you set some 
undesirable data into a View-derived object. At that time it might have not 
checked it and dutifully stored it; when it came to render time, it then 
tries to use the data and falls over. At the point where it falls over it 
would appear to be entirely within the system - but the worst the SDK could 
be accused of here is not sanity checking the data for possible faults.


It appears that this came simply from starting your app and it trying to 
display the contents of the layout, correct? Does the content of your layout 
have anything unusual in it? (If it's not too long a layout, paste it here.)


If it was triggered by some action you took from another activity [that 
started the one that failed] or if this activity did show and then this 
error triggered from some action you took on this activity, then let us 
know.



--
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] refresh gallery

2012-05-11 Thread Jason Teagle

How to change that-to refresh
SDK,to show automaticly picturs without unmounting...thank for share


('SD card', not 'SDK' - the SDK is what you're using to write code {:v) )

Try this link:
http://androidforums.com/droid-support-troubleshooting/21652-refresh-gallery.html


--
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] Couldn't get connection factory client in android

2012-05-10 Thread Jason Teagle
  I got this error: 
ERROR/MapActivity(258): Couldn't get connection factory client


Try Googling for that error message. Plenty of hits for you to follow.


--
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] Going from one view to another

2012-05-10 Thread Jason Teagle

How do you go from one view to another?  I need the user to select a
button and then go to another screen.


Each screen in Android is an Activity. The way to achieve what you are 
asking is to create an Intent [object], quoting your target Activity's 
class, and then start that intent.


This link shows how, but also demonstrates that you must remember to have 
the target activity listed in your manifest:

http://stackoverflow.com/questions/736571/using-intent-in-an-android-application-to-show-another-activity


--
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] List Item Click is not working

2012-05-10 Thread Jason Teagle

We don't need to see your picture, thanks. This isn't Facebook.



I created a list view and given the codes for list item click like



but the list item click is not working..why anybody pls help me


How are you determining that it isn't working - are you assuming your 
activity should show? The problem might be that the activity itself is 
causing a problem, so the click fires but the activity won't show. I see you 
are trying to log information... is that how you know it isn't working? 
Personally I would use Toast for testing... you can't miss it then.


Have you checked your LogCat for exceptions? For example, have you made sure 
you aren't getting a NullPointerException even trying to add the handler 
(because, perhaps, your getListView() method is returning null)?



--
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] Building an App with adjustable GUI

2012-05-10 Thread Jason Teagle
i want to develop an App with an flexible User Interface. The User choose 
an Element from
a given list and place it on the Screen.  Did anyone an example for this or 
do i have to start

from the ground?
The GUI should work like the Widget-Placement on the launchers. I'm 
thankful for every tip


I don't know of any examples without searching (which I'm sure you can do 
just as easily), but thinking about the view [that you will place the 
widgets on] for starters, you're going to need to create your own class to 
support placement at any point the user chooses - unless you plan to 'snap' 
the dragged components in to a known layout such as LinearLayout or 
RelativeLayout - but that would probably be very annoying for the user 
unless they're expecting it.


In the old days you could use AbsoluteLayout but that is deprecated since 
fixed layouts are not orientation / resolution / DPI-friendly.


Your next problem is going to be dragging the widget from the palette to the 
target view - which effectively means either somehow letting the widget have 
no parent while it is dragged, or perhaps creating some sort of 
representative drag image.


This is no small task!


--
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] How to make Items inside ListView clickable??

2012-05-10 Thread Jason Teagle

this is my adapter

...

I need to make the three views inside this listview clickable

This code is not working for me
lv.setOnItemClickListener(new OnItemClickListener() {


(For reference in the future, please state what *actually* happened - even 
if the answer is 'nothing happened' - and if it isn't obvious, state what 
you expected to happen).


I would suggest temporarily removing your custom binder to see if that is 
interfering somehow. I know nothing about what binders are supposed to do 
(for now), but the following complete sample (based on your layouts and 
almost the exact same code you provided) worked just fine for me:


package net.testing;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.HashMap;

public class ListItemClickActivity extends Activity
{
private Activity m_thisActivity = null ;

   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState)
   {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);

   m_thisActivity = this ;

   // Dummy data for a single list item.
   ArrayListHashMapString, String  mylist = new 
ArrayListHashMapString, String ();

   HashMapString, String entry = new HashMapString, String();
   entry.put(name,TestImage);
   entry.put(time,Now);
   entry.put(image,An image!);
   mylist.add(entry);

   ListView lv = ( (ListView)findViewById(R.id.listview1) );

   SimpleAdapter adapter=null;

 adapter = new SimpleAdapter(ListItemClickActivity.this, mylist , 
R.layout.newslist,

new String[] { name, time,image},
new int[] { 
R.id.newsName,R.id.newsTime,R.id.newsImage});

 //adapter.setViewBinder(new MyViewBinder());
 lv.setAdapter(adapter);

 lv.setOnItemClickListener(new OnItemClickListener()
 {
  @Override
  public void onItemClick(AdapterView? arg0, View arg1, int arg2, long 
arg3)

  {
   Log.i(LOGCAT, View  +arg1.getId());
   Toast.makeText(m_thisActivity,View  +arg1.getId(), 
Toast.LENGTH_SHORT).show();

   //Intent i=new Intent(getApplicationContext(),NewClass.class);
   //   startActivity(i);

  }

 } );

   }
}

--
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] How to make Items inside ListView clickable??

2012-05-10 Thread Jason Teagle

My class is this:


Yikes... not quite what we needed.

1. Can we confirm that you *do* see items appearing in your list - in other 
words, can we confirm that onPostExecute() *does* get called?


2. Can we confirm that - at the risk of insulting your intelligence - you 
*are* stabbing a finger on a piece of text or image in the list, and not in 
a blank space that might not actually be part of any view? {:v)


3. As I tried to get you to understand before, 'is not working for me' is 
too vague. What *does* happen when you click an item? Do you get *anything* 
recorded in the LogCat as per your Log.i() calls, or do you get absolutely 
nothing? How *exactly* are you determining that it is not working?


Having seen your ViewBinder and understanding a little bit more about what 
it does, I don't see any reason for it to be interfering. Please answer the 
above and let's see what we can figure 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


Re: [android-developers] Re: How to make Items inside ListView clickable??

2012-05-10 Thread Jason Teagle

I think now u undrstood my problem???


That's pretty much what I guessed, but it was best to check.


In your onPostExecute(), which you say is getting called (which we know is 
true, since you see list items), you have:


OnItemClickListener li=lv.getOnItemClickListener();
Log.i(LOGCAT, View  +li);


Can you confirm that *that* gets recorded in the LogCat? Since this is 
before you try to set a new click handler, it *should* be recorded. Can you 
confirm that you only see it *once* during execution? I can't see why it 
might happen more than once, but given a recent thread about views being 
recycled, I would like to check that we're not dealing with some weird thing 
like that here.


Please show us the code for setListAdapter() and getListView().


--
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] dynamic spinner

2012-05-10 Thread Jason Teagle

I have created 3 spinner dynamically
and adding listener with them but listener is single for all spinner.

I want to get selected value of particular spinner.
How can I get ?


How can we tell if you don't show us your code for the click listener you 
are adding?


If you are using onSetOnClickListener(), for example, then onClick() passes 
you the view (spinner) that was clicked.



--
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: How to make Items inside ListView clickable??

2012-05-10 Thread Jason Teagle
Now that I'm awake and read up on ListActivity, which I did not know 
existed, I have a new suggestion:


Try having your class override onListItemClicked() instead of using 
setOnItemClickedListener() directly on the list view itself. That appears to 
be the correct way to handle item clicks for ListActivity. My case worked 
because I derived from Activity and shoved a ListView in there - I'm 
guessing ListActivity bypasses click listeners in favour of its own 
protected method.



--
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] dynamic spinner

2012-05-10 Thread Jason Teagle

above code will generate spinners dynamically,
when we will click on any spinner then that method will call.

OnItemSelectedListener listener=new OnItemSelectedListener(){
@Override
public void onItemSelected(AdapterView? arg0, View view, int 
position,long arg3) {


Notice the AdapterView? argument (arg0)? That is your spinner (and 'view' 
is the sub-view of the spinner that was clicked - one of the arrows, 
presumably).


Please try and read the documentation for the classes you are using - even 
for listeners. It may not be perfect but in a lot of cases it does give the 
information you need.



--
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: Custom ListView with Checkbox

2012-05-10 Thread Jason Teagle

I  am creating a ListView using customized TextView, as shown below:



Normally we use this code for multiple list item selection:

setListAdapter(new ArrayAdapterString(this,
android.R.layout.simple_list_item_multiple_choice,
hometown));

But I have changed the 2nd argument of ArrayAdapter to my customized
TextView, hence i dont understand where to put the option for multiple
choice of list items.


You need to make sure that you have a layout for each list item that 
includes your custom TextView and a check box, but you need to do a little 
more to get automatic check functionality back.


See if this post, mentioned StackOverflow, helps:
http://www.marvinlabs.com/2010/10/custom-listview-ability-check-items/


--
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] Help Testing Code For Storage

2012-05-10 Thread Jason Teagle
I'm developing this app using API Level 8 and testing the app on a Samsung 
Intercept

running Android 2.2.2.

When I test this code on the Samsung Intercept it successfully makes a 
directory on

the SD card and will read/write files.

Will some developers please test this code and provide feedback on the 
results?


Galaxy Mini (2.2.1) with external card - succeeded.

HTC Desire S (2.3.5) with external card - succeeded.

(Worth pointing out to anyone trying this who isn't that experienced that 
you need


uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE /

in your AndroidManifest.xml - took me a couple of failures to remember 
that!)


(Might unmount external card and try on internal storage another day - not 
right 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


Re: [android-developers] setting context menu for a button

2012-05-09 Thread Jason Teagle

i tried with registerForContextMenu(button ). and setting onConext
Menu Listerner also but it did nt work .


Did you override onCreateContextMenu() to actually build the menu?

Define 'did not work'? What *did* happen - anything at all?

Try this link as an example of how to build one:
http://www.stealthcopter.com/blog/2010/04/android-context-menu-example-on-long-press-gridview/


--
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: viewport size A4 ?

2012-05-09 Thread Jason Teagle
I am trying to render a html page in WebView in my app, everything works 
fine,
but the content is wraped arounf width of browser. But my requirement is 
that


Have you tried making the main view a ScrollView, and embedding the WebView 
as a child of that, allowing it to be larger than the physical display?



--
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] how to make android games?

2012-05-09 Thread Jason Teagle

http://lmgtfy.com/?q=how+to+make+android+games


--
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] Unable to start activity ComponentInfo{...}: java.lang.NullPointerException

2012-05-09 Thread Jason Teagle

   btnAbout.setOnClickListener(aboutSelected);


The NPE could also be because btnAbout is null - does the debugger confirm 
that *that* is OK?



--
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] User Registration using CouchDB

2012-05-09 Thread Jason Teagle
This is the code for registration class, when I click register button 
nothing happens.

Please help so that I can do this..


Take a look at the code you have in the click handler you added (near the 
beginning) to the button. This click handler is near the bottom of the file:



@Override
public void onClick(View v) {
   Button login = (Button) findViewById(R.id.btnRegister);
   login.setOnClickListener(this);
}


Notice that all you do here is grab this exact same button, and set the 
exact same click listener back into it. This is why it appears to do 
nothing.


The actual code that attempts to log in is in the click listener you add to 
the *TextView*:



TextView reg = (TextView) findViewById(R.id.link_to_login);
reg.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {


etc.


Not sure why you added a click listener to the TextView - it appears you may 
have got a little mixed up about how you want your interface to work. To 
start with, to try and help make your code a little easier to follow, I 
recommend two things:


1. Move the code that attempts the login from the body of the click listener 
you added to the TextView into a separate method of the class, called 
doLogin() or something similar. For now, don't add the click listener to the 
TextView - you can sort out that additional functionality later.


2. Don't make the RegisterActivity implement ClickListener - instead, be 
consistent and add an anonymous click listener to the button (to replace the 
one you add at the moment at the start of onCreate() ). From that onClick() 
method, get it to attempt the login (and yes, I deliberately didn't specify 
exactly how, to give you a chance to examine the revised code and try and 
work it out for yourself).


See if you can repair your code from that.


--
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: setting context menu for a button

2012-05-09 Thread Jason Teagle

I tried as the same in the example defined here . but didn't get the
menu displayed .

did not work - i am not getting the conext menu at all after clicking
button .


OK. At this point I would recommend (for test purposes) you leave your 
existing project alone, start a new project with a new activity, add one 
button to the layout, and try adding the necessary code to add and show the 
context menu to the button. If it still doesn't work in a fresh project 
(which should be nice and small since it only has the one button and handler 
in it), then post your code here for us to look at.



--
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: Unable to start activity ComponentInfo{...}: java.lang.NullPointerException

2012-05-09 Thread Jason Teagle

The strange thing... today I can't reproduce it anymore after
rebooting the eclipse (heap problem).


It wouldn't be the first time Eclipse has got a bit messed up... I had some 
infinite recursion in some code this morning and Eclipse needed a couple of 
kicks up the backside after I'd fixed the problem to get going again!



--
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] Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

and one sub tab contains
listview. Now i want to start an Activity when an item from the list
is selected.

How it is possible?


Have you tried adding a listener to the list view to watch for selection 
changes?




--
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: Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

and the error i got is:



05-09 16:19:07.723: D/PhoneWindow(7043): couldn't save which view has
focus because the focused view android.widget.LinearLayout@44ecc1d8
has no id.


Take a look at that line - what does it say is the reason for being unable 
to do what it wants? The error message is pretty clear about the reason for 
the failure - and should be a clue as to how to fix the problem either in 
your XML file or if you are building the UI manually, by making an extra 
call on the LinearLayout.



--
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: Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

05-09 16:19:07.751: E/AndroidRuntime(7043): Uncaught handler: thread
main exiting due to uncaught exception



05-09 16:19:07.771: E/AndroidRuntime(7043):
java.lang.RuntimeException: Unable to pause activity {com.m2.smartGui/
com.m2.smartGui.smartGuiPagerFragmentActivity}:
java.lang.NullPointerException


There's another problem here, but it's a little hard to sort out exactly who 
did what here. It appears to be trying to pause as if you are moving away 
from the app.


What *exactly* happens in your app, and at what stage? Does it start running 
OK? Does it crash / abort when you change tabs? Does it go wrong when you 
click an item in the list view? And when it goes wrong, what exactly 
happens?



--
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: Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

The app crashes when i click on list item. Actually this listview
resides in a tab which is in another tab of a fragment.


It could be the nesting that is the problem, or the starting of the 
activity. So let's just try and isolate the cause - in your click handler, 
instead of creating the intent and starting the activity, just do nothing. 
If that doesn't crash, construct the intent as before (but don't start the 
activity yet). If that is OK, pop up a message with Toast after creating the 
intent (so we are hopefully taking the focus away from the tab layout 
briefly).


If all of that is OK, try creating a dummy activity of your own with a 
button, and have the intent use *that* class (and start the activity) - so 
we start an activity but it's a small, harmless(!) one of your own.


Tell us if any of those steps still causes a crash, or if all of it works 
OK.



--
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: Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

Sorry, It worked!   I forgot to add the activity in manifest.


(Don't worry, I just learned something about activities there as well!)

OK, so the dummy activity worked, and that also means that taking focus away 
from the tab arrangement *shouldn't* be the problem - since that would have 
happened for your dummy activity.


Is the 'player' activity one of your own classes? I'm afraid the fault 
points to that now. I recommend you start isolating parts of that (in its 
onCreate() ) and try to narrow down the cause like we did here.



--
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: Starting an activity from Fragments.

2012-05-09 Thread Jason Teagle

Thank you Jason Teagle, The error was in player activity, the player
class needed a native library and that library was missing.

You were so kind to listen me. Thankyou so much.


Another happy customer {;v) 



--
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] Regarding WIFIInfo bssid ssid

2012-05-09 Thread Jason Teagle

So just want to know is any there any unique identifier for  wifi
network which will be unique  constant on all devices..


The MAC address? This can be obtained from a WifiInfo object... 





--
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] Regarding WIFIInfo bssid ssid

2012-05-09 Thread Jason Teagle

But is it device wifi mac address or active wifi network mac address...


It will be the MAC address of the phone / device the software is being run 
on.


I may have misunderstood what you were trying to do here - are you trying to 
identify the 'other' end of the wi-fi connection? The access point? So any 
phone / tablet can use your software (this end can be any network), but it 
can only perform this action when connected to a specific access point?



--
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] How to deal with negative anonymous reviews?

2012-05-09 Thread Jason Teagle

We really appreciate your thoughtful feedback, and we'll keep it in
mind as we work to improve Google Play.


Wow... hot off the photocopier, methinks.

Sorry to hear about your situation. I can only recommend - since it is clear 
you're not going to get any help from Google on this - that you rely on the 
common sense of the average user. If I see a low rating with no comment, I 
generally ignore it. I would only take note of a low rating if the 
accompanying comment looked like it had been constructed carefully and 
presented comprehensive points, as opposed to simply ranting.


Like the subject of licencing and cracking, sometimes the best approach is 
simply to put the effort into making the apps good and useful so that the 
good people buy them - and don't waste valuable time and effort on trying to 
stamp out the negative, since no matter how hard you try, there's always 
someone around the corner who's going to undo your hard work.



--
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: Exception Locking Canvas

2012-05-07 Thread Jason Teagle

Any idea why does the request to acquire/allocate Graphic Buffer fail
with Bad address?

W/GraphicBufferMapper(2541): registerBuffer(0x3a2408) failed -14 (Bad
address)


Unfortunately that's one that I can't answer - how it can manage to get an 
invalid address from within its own internal code is beyond 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] Re: gridview empty cell selection doesn't remove instantly after drag-n-drop from gridview

2012-05-07 Thread Jason Teagle

Can anyone plz tell me why this is happening, or how do I solve this issue?


If we could, don't you think we would have done so by now?

Have you *tried* calling setSelection(-1), or calling requestFocus() on 
another View to take the focus away from the GridView?


Have you posted some code to show us how you perform the drag-n-drop, so 
that we might have a chance of seeing what might be wrong... or are you 
expecting us to magically fix code we can't see?



--
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: gridview empty cell selection doesn't remove instantly after drag-n-drop from gridview

2012-05-07 Thread Jason Teagle

sry for not being very clear,
ps have a look at it.


(Quick note: In every single case you call

int xxx = mDraggableView.getDragItemId();

When dragging from the gallery, you call it 'fromPosition'; when dragging 
from the grid, you just call it 'position'. Since you *always* make this 
same call, why not just have


int fromPosition = mDraggableView.getDragItemId();

at the beginning once, outside of the chain of ifs? It would then streamline 
your remaining code a little. It won't fix the problem, but it would make it 
easier to follow as there would be less [repetitive] code.


Also, when providing sample code for a problem, please try to only show code 
around the suspected problem itself unless asked specifically for more - in 
this case we only needed to see where you remove it from the grid and try to 
clear the selection!)


These appear to be the relevant lines:

   draggableGallary.requestFocus();
draggableGrid.setSelection(-1);

A couple of things:

1. Try calling requestFocus() *after* setSelection(). I doubt it will make 
any difference, but it's worth a try for five seconds of effort.


2. Try calling draggableGrid.invalidate() after those two lines. It might 
force the grid to repaint, removing the focus rectangle.


3. Can the gallery actually *accept* the focus? If it can't, then trying to 
give it the focus is probably failing and throwing the focus back where it 
came from - onto the grid. Make sure that you call setFocusable(true) and 
setFocusableInTouchMode(true) on the gallery view.


4. If all else fails, a dirty trick that might just work is that when the 
grid has no items left, remove it from its parent view and then re-add it, 
if feasible. The act of removing it should make absolutely sure it loses the 
focus, and it *shouldn't* automatically get it back when you re-add it. Not 
really a recommended solution but if it helps with the focus problem... then 
so be 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] AccountAuthenticatorActivity

2012-05-07 Thread Jason Teagle

i  have problem with application context
when i call ContentResolver cr=mContext.getContentResolver(); its
return nullpointerexception and is coz of the appContext how i can
reslove that any help with that thx on advance


Where is 'mContext' set? If you could show us the lines of code where it is 
declared and later set, that would help.


Since you are creating your own class here, you could pass the application 
context into this class' constructor for storage - but since you are 
[apparently] storing the context as a member variable, I would hope you are 
already doing something like that somewhere...



--
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] AccountAuthenticatorActivity

2012-05-07 Thread Jason Teagle

wish that is any help with this scenario thx in advance


Is this AccountAuthenticatorActivity-extending class the main class / 
activity of your application, or are you starting this activity yourself 
from somewhere? The reason I ask is that starting a new project, making my 
main activity extend AccountAuthenticatorActivity and testing 
getApplicationContext() there worked fine - it gave a non-null result:


---
package net.testing;

import android.accounts.AccountAuthenticatorActivity;
import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

public class TestAccountAuthActivity extends AccountAuthenticatorActivity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);

   Context c = getApplicationContext();
   Toast.makeText(this, c == null ? It's null! : It's valid, 
Toast.LENGTH_LONG).show();


   }

}
---

(It showed 'It's valid' on the screen as expected.)

Also, is there a reason that you set mContext when you appear to be using 
the context immediately, and within the same body of code (therefore making 
the assignment to a static member unnecessary)? It won't make any difference 
to the result unless... you are doing something unusual with it elsewhere.


Are you *sure* the NullPointerException came from this line:

ContentResolver cr=mContext.getContentResolver();

? Could you perhaps show us your LogCat (screen snapshot?), showing the 
lines where it indicates where in your source code it happens?


(You can easily check the value of mContext before you try to use it using 
the Toast technique as a temporary way of seeing the answer, like I did.)



--
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: Different Font Size on a Button

2012-05-07 Thread Jason Teagle
i.e. using an html string like big199/big smallkm/h/small seems 
to work,

although you cannot specify the sizes exactly...


Just a quick note, specifying big / small or similar is considered better 
than specific sizes in the world of accessibility since they refer to a size 
*relative* to the user's current default font - so if they have enlarged the 
font to cope with having difficulty reading it, then an application won't 
suddenly change to a font that is too small to be readable for the user.



--
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] AccountAuthenticatorActivity

2012-05-07 Thread Jason Teagle

try mContext = this;


That would then be an activity context, not an application context. Although 
it might work for the case required (I doubt it - see below), there are 
reasons for using one over the other.


http://android-developers.blogspot.co.uk/2009/01/avoiding-memory-leaks.html


It also doesn't help solve the problem of why the OP is getting a 
NullPointerException when trying to use the context they collected (if that 
is the actual problem they are getting).


Note the first line of the second paragraph:
http://developer.android.com/guide/topics/providers/content-providers.html

When you want to access data in a content provider, you use the 
ContentResolver object in your *application's* Context



--
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] Bluetooth chat application problem

2012-05-07 Thread Jason Teagle

I have installed Bluetoothchat  Example on my phone.
when i run Connect Secure/Insecure then it always show

...

I have debugged application. i found the error is : javaIO exception
Service Discovery failed


See if this link helps:
http://stackoverflow.com/questions/3397071/service-discovery-failed-exception-using-bluetooth-on-android


--
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: gridview empty cell selection doesn't remove instantly after drag-n-drop from gridview

2012-05-07 Thread Jason Teagle
Make sure that you call setFocusable(true) and 
setFocusableInTouchMode(true)

on the gallery view.


This one helped me doing what I wanted, but only for the first time. After 
first dragging,

its not working according to me.


You only need to call those once, when you first create the gallery view - 
after that calling it again shouldn't have any effect.



4. If all else fails, a dirty trick that might just work is that when the 
grid has no items left,


Its not what I want.


Neither is the focus staying on the grid... you may have to accept one or 
the other.



Did you try changing the order of setSelection() and requestFocus()?

Did you try calling draggableGrid.invalidate() after setSelection() and 
requestFocus()?



--
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: gridview empty cell selection doesn't remove instantly after drag-n-drop from gridview

2012-05-07 Thread Jason Teagle

Did you try changing the order of setSelection() and requestFocus()?

Did you try calling draggableGrid.invalidate() after setSelection() and 
requestFocus()?


Yes, I tried all of them, but nothing worked.


OK, one more thing you could try, and then I'm out of ideas.

When you remove the last item from the grid view, call setFocusable(false) 
and setFocusableInTouchMode(false) on it *before* calling requestFocus() 
elsewhere. That way, it should *never* be able to get the focus back. When 
you add items back to it, you can set them both to true again.


Bear in mind, the problem might not be to do with focus - it might be that - 
whether it has the focus or not - it insists on drawing the 'selected item' 
no matter what - even if it has no selection, or no items to show. It's 
possible that it doesn't like being empty, and expects at least one item in 
it.


A final possibility is to create a class that extends GridView, and override 
onDraw(). When it has no items in it, do *not* call the superclass version 
(as you would under normal circumstances). That should prevent it from 
drawing the selection indicator - but it may also prevent it from drawing 
the background (but you could compensate for that by manually drawing the 
background only).


The problem may simply be that you are using it in a way it is not designed 
for (empty grid views) - so we are fighting the system.


After that, you're going to have to hope someone else on here has some 
suggestions...



--
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: gridview empty cell selection doesn't remove instantly after drag-n-drop from gridview

2012-05-07 Thread Jason Teagle

My problem just solved by doing this little modification:

1) Refreshing the adapter on drag and drop.
2) And then setting the adapter to my gridview.


Good to know. Definitely a more 'correct' solution than most of the tricks I 
was suggesting (not least because yours worked!).



--
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] how to disable options to select or cut or paste on text selection with android 4.0

2012-05-07 Thread Jason Teagle

In android 4.0 version, when u select  long press text(specially a
link or edit text),it shows an ui with some options  like cut(scissor
image),select all,etc..

Is there any way to disable that or any callback method to intercept
that ???


Have you considered calling setLongClickable(false) on those items, or 
setOnLongClickListener() with a listener that does nothing?


Beware, though, that overriding the expected system behaviour is not always 
a very nice thing to do to a UI; people come to expect these standard 
features in applications. Consider your choice very carefully...



--
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] how to disable options to select or cut or paste on text selection with android 4.0

2012-05-07 Thread Jason Teagle

In the log it showing

05-07 16:58:29.400: INFO/WindowManager(183): ... DRAW NOW PENDING


OK... when is it showing this? Is this after you tried adding 
setLongClickable() or setOnLongClickListener()? I'm not sure how this 
relates to what you asked...



--
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] Activity lifecycle and a null cursor

2012-05-07 Thread Jason Teagle

adapter = new SimpleCursorAdapter( /* query the SQLite db */);

I can't understand why cursor may be null, since onResume() it's clearly 
initialized by

the query.


You would expect so, but it couldn't hurt to check (as a debugging test) if 
adapter.getCursor() actually returns a valid cursor immediately after the 
call to new SimpleCursorAdapter() above.


It might also be worth checking that the adapter instance you set into the 
list view in onResume() and the one you are subsequently seeing in 
onClickItem() are one and the same. Again, you'd expect it to be, but at 
this point you've got little to lose by checking.


Just as a sanity check, make sure onResume() *is* being called as you 
expect, before onClickItem() fires. Stranger things have happened...




it's clearly initialized by the query

...

since obviously it must be non-null


If programming (and running into problems) can teach you one thing, 
hopefully it will be that making assumptions is a mistake {:v)  There is 
nothing in the docs for the SimpleCursorAdapter constructor that says it 
*guarantees* a valid cursor after the operation, even though that is the 
logical expectation.



--
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] Activity lifecycle and a null cursor

2012-05-07 Thread Jason Teagle
while debugging on my devices (and emulators) I never got this NPE, so 
basically

I am blind and must try to figure out what could happen on other devices.
But, without being able to reproduce this behavior, the local debug is 
useless. I'd

need to get in touch with the users


I don't envy you in that difficult situation. If you can enlist the help of 
several helpful users to help you track it down by adding temporary debug 
info into the code and letting them use the temporary version of the app, it 
will be of benefit. It's in their interest as much as yours to get the 
situation resolved.


Are you aware of any devices in particular that cause this problem?



Triple checking everything is not the way to make robust software.

...

with unneeded checkings,


Be careful about this philosophy. In your code sample, for example, you have

Cursor cursor = adapter.getCursor();
int position = cursor.getPosition();

You are using 'cursor' here without checking it for null - you have *zero* 
checks in there. Whilst I appreciate that 'triple checking' was a slightly 
exaggerated comment, having *no* checks can be just as bad.




because if I don't catch the bug it will pop up sooner or later


Agreed. But having your users have to put up with constant failures because 
you prefer leaving things to fail so that you catch them rather than coding 
defensively (and *log* the issue in a catch handler, for example, so that 
you still get information on the problem somehow) isn't always an ideal 
situation. Some users will prefer to have it fail rather than do something 
odd, as per your philosophy, but others will prefer to have it try its best 
to move on rather than die, die, die. I'm willing to bet that the majority 
fall into the latter category.



Android seems to me too much an unreliable platform. i don't know if it's 
for

missing documentation, bad design or whatever, just every piece of the API
fails at some point


Although I do feel that the documentation has lots of room for extra 
information, I would suggest that more of the problem you state is to do 
with trying to get one platform (Android) to cope with all the nuances of 
each manufacturer's (and even each model's) hardware and firmware. It's not 
as if manufacturers code with the OS in mind (except, you'd hope, Google's 
own devices!).




Can a click event be fired before onResume() finishes executing?

...
because it'd completely break the usefulness of Activity lifecycle 
callbacks


Totally agreed. I would be alarmed if it were possible, to be honest.


cursor and populate the listview, and since the listview is not empty 
(otherwise one
could not click an item and thus firing the event listeners), how can we 
have two

different adapters?


I agree that it seems ludicrous, but bear in mind that you are (in the click 
handler) referring to a variable you are maintaining manually (adapter), 
rather than getting the adapter directly from the list view. There is also 
the possibility of a threading issue, but since everything happens in the 
same activity I assume this should not be an issue - it should all be 
happening on the main UI thread.


I can only suggest using

(SimpleCursorAdapter)listView.getAdapter().getCursor()

rather than using the [adapter] member variable and see what happens.


--
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: View Pager performance hit when inflating views

2012-05-07 Thread Jason Teagle
But as soon as i add a linear or relative layout as parent to list view 
...i am

able to see the lag while scrolling


Although I can't really help you reach an answer that will help, I will just 
say that using layouts as the parent *will* decrease speed performance due 
to having to do the extra work to lay everything out according to the rules.


Why were you trying to add a parent layout to the list view? Is the list 
view not the only item on the screen, per page?



--
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] Confirmation with pressing back button

2012-05-07 Thread Jason Teagle

One of these is that when the user press the back button of the phone -
I mean that with a curved arrow-, the application is closed, so I want
to ask for confirmation or something similar so, is there anyway to
easy control this?


I believe this link will help you considerably: 
http://stackoverflow.com/questions/4779954/disable-back-button-in-android



--
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] Activity lifecycle and a null cursor

2012-05-07 Thread Jason Teagle
Unfortunately the crash reports don't show the device model. The NPE happens 
when the user clicks a row or one of the buttons in a row (since all three 
actions share the same code). 

I have imagined a possible cause for this issue. Looking into the sources 
(android/view/View.java) here is what the constructor does when it founds 
android:onClick in XML: an anonymous listener is created, and this listener 
will call the method on the Context returned by View.getContext(), but this 
context may be a different instance than the one currently holding the view. 
This is because Adapter.getView() gives a chance for reusing an already 
existing View, and the default strategy for CursorAdapter (as seen in the 
sources) is to reuse that simply if it's not null. So here is my scenario
  1.. Instance#1 of MyActivity is created, its listview is set up and shown. 
Instance#1 is set as the listener for the list_item view, as per 
android:onClick in my XML layout 
  2.. onPause is called on instance#1, which causes my method to set adapter's 
cursor to null 
  3.. the system decides that a new instance of MyActivity is needed, so 
instance#2 is created. A new cursor is also created and its contents are shown 
in the list view (via bindView()), but the list item views are recycled 
somehow, since they were kept in a cache. The old views still keep a reference 
to instance#1, so when the click event is triggered, instance#1.onClick() is 
fired and it founds a null cursor, thus throwing the NPE 
This explanation requires a little bit of imagination, but I think it's still 
realistic, even if all is to be demonstrated. I am writing a separated, minimal 
test case to dive into the Android classes with the debugger, but it's not 
simple. I use an activity with a list view as the only content view, and a 
list_item with an android:onClick property defined in XML. My goal is to see if 
a new instance of the activity can be created even when another one is already 
available. From the Android doc, this would be perfectly legitimate, but is not 
easy to trigger. The second step is to click the list item and compare the 
list_item's context with the current Activity. If they are different, we have 
caught it.

Does anybody have any suggestion or experience on this?

@Jason, as per the tap tempo, the algorithm to detect the BPM requires three 
taps at enough close intervals, and the resulting value must also be in the 
constraints. If you try to tap while you listen a song, it will do its job

@Blake, I can argue it from the stack trace. The NPE is throws at this line
int position = cursor.getPosition();
so the cursor is obviously null, and the only code that change the cursor (and 
the adapter) is onPause(), where I set adapter.changeCursor(null);

-- 
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: something better than 16bpp

2012-05-07 Thread Jason Teagle

The P1000 seems to have a lcd screen. Anyway, i believe it is just a
matter of time to have real 24-bpp screens on the market. My only
concern is about a way to identify them.


Have you considered the option of defaulting to 16 bpp, and letting the user 
choose whether to try changing up to 24 or 32 bpp - and let them decide if 
it's worth it? Rather than you make the choice, provide settings that the 
user can tweak as they wish. That way the headache of trying to get the 
correct information is gone.



--
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] Confirmation with pressing back button

2012-05-07 Thread Jason Teagle
Depending on the version of Android you are targeting, this will also be 
very helpful:

http://android-developers.blogspot.com/2009/12/back-and-other-hard-keys-three-stories.html


lol... I didn't even know you could long-press hard buttons.


--
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: Add application licencing to apk

2012-05-07 Thread Jason Teagle

Take a look at the instructions here:
http://developer.android.com/guide/market/licensing/setting-up.html#add-library

Particularly, look a few lines down where it starts If you are developing 
using the SDK command-line tools


Why you aren't using Eclipse, though, is a mystery. Why make it harder for 
yourself?



--
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: Exception Locking Canvas

2012-05-06 Thread Jason Teagle

There are two reason for canvas lock; the other is failed to dequeue
GL buffer. THe following is written to the logs when this happens:

W/GraphicBufferMapper(2541): registerBuffer(0x3a2408) failed -14 (Bad


Are you manually locking / unlocking this canvas yourself, in your code? Or 
is it happening as part of the system when your app resumes? My reason for 
asking is that the second error type you are getting makes me wonder if you 
are passing some address that you have been storing, and that stored 
information is invalid because it either became corrupt, or was not the sort 
of thing you should be storing, or a third option is that it is something 
that is valid while the app is in the foreground, but should not be used 
once the app has resumed (because, perhaps, things get built anew). You may 
be getting away with it for a while as the system tends to reuse the same 
address (only a theory, but definitely a feature we should not rely on), but 
eventually after some memory shuffling (garbage collection, for example, or 
other apps claiming memory) it changes.


Of course, if all this is being done by the system and you have no input 
then I'm as baffled as you are!



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
So I have been trying to the give the user the ability to the rotate a 
picture, but still i

haven't found much about it. Can you plz explain more to me. Thanks


http://lmgtfy.com/?q=rotate+image+android


--
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: are text files in assets translated to the local language?

2012-05-06 Thread Jason Teagle

It is not actually hard, but there are so much details that you have
to think of that your program needs to adjust to. A simple one is what
do the country use for decimal separator? Comma ',' or point '.'?


Another example is pricing - not all locales put the currency symbol in 
front of the number, but instead put it behind.




--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle

This is the code im using to rotate an image,


All that code does is determine the angle in degrees to rotate by - it 
doesn't actually try and rotate an image. Show us the code where you 
actually load / set the image into an object, and then how you attempt to 
apply the rotation angle you obtained from the code you just posted for us.



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
After using the code, still if i take a picture sideways or in an upright 
position its not rotated.
When I take a picture sideways and load, it shows up in an upright position 
but stretched.


Like I said, show us the code where you take that picture from the camera, 
put it into an object, and try and apply a rotation.



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
For testing purposes, I would suggest you temporarily put the camera code 
aside, and do some testing on a simply image loaded from resources. My 
reason for saying this is to remove any possible outside issues, and just 
concentrate on the scaling of an image. I see your code, which seems like it 
*should* work, although we can't see how you form the 'matrix' variable, 
which may be the problem.


This code, for example, worked fine for me (logo is 141 x 36, a JPG):

---
// Scale twice as high:
Bitmap logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
Matrix m = new Matrix();
m.postScale(1.0f, 2.0f, logo.getWidth() * 0.5f, logo.getHeight() * 0.5f);
logo = Bitmap.createBitmap(logo, 0, 0, logo.getWidth(), logo.getHeight(), m, 
true);

---

Once you can satisfy yourself that the actual scaling is working as 
expected, then you can start looking for outside problems - such as how you 
generate 'matrix', for example. It would also be worth drawing the picture 
you get from your camera as-is, alongside the result of your attempts to 
'correct' it, to make sure your source picture is actually coming through 
the way you think it is. You'll kick yourself if you find it's already 
coming through rotated or something!



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
What is this error, my project suddenly doesn't want to execute, 
java.lang.

RuntimeException: Unable to start activity ComponentInfo{project.moe/
project.moe.ProjectActivity}: java.lang.NullPointerException.. I didn't 
change anything


First, I suggest you restart Eclipse, disconnect your phone and then 
reconnect everything - if you have been doing a lot of debugging, things may 
have gotten a bit messed up.


I would be surprised if you got this error suddenly for no change in code... 
but if you are relying on stuff from the system, such as the camera, then 
who knows what might have happened.


If the problem comes back when you've restarted and reconnected everything, 
then post the last few lines from your LogCat if possible - screen dump it 
if you have to (but a cut and paste of lines would be preferable!). That 
error with no context is simply impossible to pinpoint. Does it quote source 
code and line numbers? If possible, make sure that the sample of LogCat you 
give us includes some lines of *your* source code in the stack dump.



--
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: Exception Locking Canvas

2012-05-06 Thread Jason Teagle

If we keep the application up for long duration of time, this issue is
seen more frequently.


Here, do you mean you simply leave the application as the foreground app for 
that length of time and it just 'happens', or do you mean the app is left at 
the front and after a long time, when you suddenly move to another app and 
back to yours it goes wrong [more often]? (You originally said after 15 - 20 
switches back and forth, but this comment implies something else.) I'm 
trying to establish whether it is exclusively due to moving to another app 
and back to yours or occurs in other situations.


Going back to your original post, you describe capturing and rendering a 
bitmap to a surface and then removing it on pause.


1. Could you show us how you perform these two tasks, your code? I'm 
wondering if maybe the way you are doing it is leaking memory and eventually 
failing, or otherwise not releasing / unlocking resources properly, 
eventually reaching the limit.


2. If you avoid using the bitmap at all (no rendering from / on it - don't 
even create it), does the problem go away?


3. When you say 'captured and rendered', what exactly does the 'captured' 
part mean? Captured from where?



--
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: Exception Locking Canvas

2012-05-06 Thread Jason Teagle

I meant - If we use the app for a longer duration of time without
navigating out or switching to a different app we see Canvas Lock with
Bad address.


Hmmm... since that [particular case] pretty much eliminates problems caused 
by activities going to the background and possibly being killed, that 
suggests that the problem is in how you are rendering to the surface. See 
below.




Even when we keep transitioning between activities quickly, after
15-20 tries, we observe the same Lock Canvas issue.


(Which suggests a resource / other memory leak or releasing problem, or 
threading issue. Can't think how to progress that one for a moment.)




The first activity
has a GLSurfaceView on which we render Bitmaps(drawing in DIRTY MODE).
This activity is never finished.


But have you accounted for the possibility of your app being killed under 
heavy device load while it is in the background, for the case where fast 
switching back and forth causes the failure ('fast' implying that it might 
not be getting time to garbage collect properly, causing allocated memory 
build-up)?


(I don't know how one should protect against that other than to save program 
state on a pause - I'm hoping more experienced members are still reading 
this along with us.)




These bitmaps are rendered/cleared from the
GLSurfaceView everytime an activity is Entered/exited from, using
Broadcasts.


Can you be sure you are not trying to use information in a broadcast 
receiver that may no longer be valid because the calling (= 
broadcast-sending) code has dumped it too early? (It is my understanding 
that broadcasts are asynchronous - if that is not the case, then ignore this 
bit.)




After a bitmap object becomes useless in the context, we
pop it from the stack, call recycle to free native memory and nullify
the java reference.


Sounds pretty sensible. In case the problem is gc not getting enough time to 
do its job, might be worthy temporarily calling System.gc() every time you 
dump a bitmap - I'm not sure this is a wise choice for permanent code, but 
it might help show if the problem lies in this area.




Yes, if we remove the calls to GLSurfaceView.requestRender() the issue
goes away.


OK, but now a slightly different test: go back to calling requestRender() as 
before, but in your custom renderer, just do some standard OpenGL stuff like 
outputting a dummy triangle or two; don't try rendering the bitmap to the 
surface. So we're going through the frame rendering process (basic OpenGL 
stuff), but avoiding doing anything fancy with a bitmap (not that rendering 
an image to an OpenGL surface should be a problem, but still). Don't create 
any bitmaps or destroy them - so we're basically trying to take the bitmap 
itself out of the equation and see if that is where the problem lies).


(This should be a separate test from trying System.gc() mentioned above - 
try gc() first, as is the quickest to try.)



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
so i did restart everything and still it doesn't want to run. And no i 
didn't change

anything in my code.


Very odd! Are you relying on any external resources, such as phone hardware, 
memory cards, etc.? Something that might have changed its state suddenly 
(thus, your code remains the same but values you are obtaining from those 
items are no longer valid)?




Attached you will the logCat errors


OK, what is at line 23 of ProjectActivity.java? That appears to be the 
problem line at this moment. Can you trace the references being used at that 
line, to find out where they are coming from? It would be helpful if you 
could show us some code around that line, even if you have to change 
variable names to avoid showing us proprietary information - but I do 
appreciate that you have restrictions.



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
I have to suggest that line 23 as you indicate is incorrect; there's no 
executable code there, not even if we assume it refers to the onCreate() 
definition.


In the sample you gave us, possibilities for the problem reference include 
R, R.layout, 'enter', 'moe' and the result of new Intent(moe). I seriously 
doubt that 'this' can be null (which would cause failure at 
setContentView(), findViewById() and possibly super.onCreate() and 
getApplicationContext() ), since this is being called from an object just 
constructed by the system, and I find it hard to believe 'R' or its layout 
is null... but you never know.


Although you are using the camera, it certainly doesn't have any related 
code in this file (at least, not where you show us the sample), so I will 
assume it is not the problem; however, I did forget to suggest rebooting 
your phone, in case it is out of memory for some reason. Not sure if you 
already did that.


If it is still a problem then, I would start trying to examine the value of 
some references during that little piece of code you showed us to find the 
actual culprit. Maybe then we can figure out from where and for why. If 
you're desperate, try using


Toast.makeText(this, ..., Toast.LENGTH_SHORT).show();

before and after each line to figure out how far it gets before it fails.

(BTW, the 'Button enter' you declared at class scope is being hidden by the 
'Button enter' you declare temporarily later, to which you assign the result 
of findViewById(). If you subsequently try to refer to 'enter' in other 
methods of that class, *that* will *definitely* cause a problem, probably a 
NullPointerException. Do *not* try and set the class version of 'enter' to 
the result of findViewById() - I believe it is a bad idea to try and keep 
such references to controls across method calls.)



--
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] Get the htmlcode of a webpage

2012-05-06 Thread Jason Teagle

Can anyone show me how to get the htmlcode of a webpage?
I tried HttpURLConnection but it doesn't work.


The documentation for HttpURLConnection has a sample right near the top 
demonstrating this - are you getting a compilation error? A run-time error 
(show us your LogCat)? Just getting nothing back even though there are no 
errors? 'it doesn't work' is a little vague. Show us some code, and explain 
what actually happens...



--
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] Creating Dialog Box in ListActivity when LongItemClick is performed

2012-05-06 Thread Jason Teagle

I want to create a dialogbox when my item in my list is long clicked but

as you can see in the code new DialogInterface does not accept the
OnItemLongClickListener() method. How can I manage it?


Can you clarify what you are hoping to do here - display a dialog *after* 
someone long-clicks an item in *another* list somewhere, or show a dialog 
and when someone long-clicks an item in the *dialog*, you want to do 
something?


If the latter, can I ask why you want to do this, rather than the standard 
click that is apparently the expected way to interact with it?


I'm guessing that if you want different behaviour from the default, then you 
are going to have to build your own dialog based on the Dialog class...



--
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] Integrating ads in android application

2012-05-06 Thread Jason Teagle
How to integrate ads in android application. I have tried with google 
android

developers steps. But it is not working


Please start by showing us the code you have tried, and explaining what you 
expected and what actually 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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Slide Show App for Android

2012-05-06 Thread Jason Teagle

How to create a Slide show app for android ??
can i get the source code for this app ??


http://lmgtfy.com/?q=slide+show+app+source+android


--
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]

2012-05-06 Thread Jason Teagle
How can i read a file from a USB Pendrive from my HTC Desire Z with other 
words

how can i enable usb host mode on my phone.


This is by no means a complete answer, but perhaps reading the docs here 
might help get you started:


http://developer.android.com/guide/topics/usb/host.html


--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle

Believe it or not the project is running again :S,


I've seen plenty of weird stuff - I believe you {:v)



Check the attachment, what I'm trying to do for my project works perfectly
in the emulator but not the Samsung S2 Galaxy. I'm basically trying to load


One possible answer for this (working in emulator but not in a specific 
device) is that you may have made some assumptions about how the data gets 
from the camera / media manager to your side of the code, or the Galaxy is 
simply going against most phones in its behaviour.


Now that you've got code working again, I refer you back to a suggestion I 
made earlier, which is to display the image exactly as you get it from the 
camera / media manager, without any manipulation from your code. Examine how 
that compares on the emulator and the Galaxy, and see if they are giving you 
different results. Putting the orientation information from the EXIF data 
into a TextView so you can see that for both devices would help.


(My rather weak theory is that perhaps the device is trying to be helpful 
and automatically rotating it for you, so you're rotating an image that has 
already been manipulated - although if that were the case, I would expect it 
to change the EXIF data accordingly.)



--
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] Fitting image to a screen

2012-05-06 Thread Jason Teagle
I don't think my rotation is code is executing very well, because I was 
testing now.
I took a picture in an Upright Position and when i loaded it it was 
sideways and

stretched.


Oh dear! Hopefully the image without manipulation will be a good point to 
re-start figuring it out.



One other thing is that when I load the picture I can't move any of the 
handlers.

When I comment out the picture code, the handlers move weird.


OK, well, let's concentrate on one problem at a time. When the rotation 
issue is fixed, you can have a fresh look at the next problem and see if you 
can see what's wrong. Getting a good night's sleep in between certainly 
wouldn't hurt!


Good luck.


--
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] Item click inside Listview

2012-05-05 Thread Jason Teagle

how can i identify the click on my comment option inside each listview???
is it possible???coment is a textview inside listview...please 
help


If I understand what you are asking correctly, you should be able to use 
setOnClickListener() on the ListView. This has an onItemClick method() that 
passes you a reference to the embedded widget, its position and id, making 
it easy to detect the one you are looking for.



--
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] Exception Locking Canvas

2012-05-05 Thread Jason Teagle

E/ViewRootImpl(10414): IllegalArgumentException locking surface


I notice that it says 'illegal argument' - can you be absolutely sure that 
at the point where it fails, the Rect you are passing for the dirty area is 
a valid rect? Can you bounds check it against the extents of the surface as 
a sanity check?


Quite why it should fail after a while I don't know, but it might be a place 
to start looking...



--
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] Sound problems when trying to play same sound very fast

2012-05-04 Thread Jason Teagle

the point it should, and further sounds twice or even three times at
same time. At fastest speed it sounds three or four times fast at
the start, and then it does not sound anymore.


Have you tried increasing the number of streams, in case you are queuing too 
many occurrences of the same sound and it is dumping older ones because of 
the limit on the number of streams?


If that doesn't seem to help or you already have a high number of streams, 
it might be worth keeping track of the stream IDs you get back and manually 
stopping older ones yourself to ensure there is always room for newer ones 
to play properly. You may simply be overloading the media player with too 
many requests.



--
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] about pop up notification

2012-05-04 Thread Jason Teagle
we should get the notification on the main screen of android tat u have 
recvd a update

like pop up ,so how to implement this can anybody please help me out


For the popup itself, take a look at the Toast class in the Android docs.


--
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] Problems with Rect.intersects

2012-05-04 Thread Jason Teagle

rect.intersects(left, top, right, bottom)


This version of the function does not change the rect:

Returns true if this rectangle intersects the specified rectangle. In no 
event is this rectangle modified. No check is performed to see if either 
rectangle is empty. To record the intersection, use intersect() or 
setIntersect().



There's a version called intersect(left, top, right, bottom) (note the lack 
of final 's' in the method name) that changes the source rect.



--
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] How to link Android project to another project within Eclipse

2012-05-03 Thread Jason Teagle
From Eclipse I created a link to the .class file of the other project into 
the bin/classes/...
folder in the android project.  Then I configured the other project in the 
java build path

of my Android project.


You shouldn't need to do any manual linking. Assuming the shareable class is 
in a project of its own (for example, called 'Libraries') and both that 
project and your working project that needs to use the class are open in the 
same workspace, if you go to the Java Build Path and the Projects tab, then 
click Add, it should list your other project - check the Libraries project 
and that should be it.


In fact, on the Windows version of Eclipse at least, if I simply refer to 
the shared class in my project then Eclipse usually offers 'Fix project 
setup' as an option for Red Wavy Line resolution - and it seems to know the 
Libraries project is the right project to include.



--
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] Flexible Relative Layout

2012-05-03 Thread Jason Teagle

when i click the Button Top, the image position will change to  the
top of screen, but when click the Button bottom, image change to the
bottom of screen.

is there any idea how to do that? Using the relative layout


Changing the rules on widgets after the initial layout doesn't seem to quite 
work correctly, even if you build a new LayoutParams object, add any 
replacement rules and call requestLayout().


The only way to make it work for me, therefore, is to call removeAllViews() 
on the RelativeLayout and simply rebuild all of its child widgets in the 
desired order. As long as you don't have a very complex layout it doesn't 
generate unsightly flicker.



--
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: Flexible Relative Layout

2012-05-03 Thread Jason Teagle
... to call removeAllViews() on the RelativeLayout and simply rebuild
all of its child widgets in the desired order...

when i called them? when I click the button? hmm..do you have any
tutorial or sample for this one? couse i'm  a newbie in android
developer ^^

Correct, when you click the button. Assuming you have built the original UI 
using the designer built into Eclipse, and let's assume you have given the base 
layout an id of 'base_layout', the buttons ids of 'up_button' and 'down_button' 
and the image an id of 'my_image', your code for rebuilding the UI would go 
something like this (apologies for line wrapping): 

public void onClick(View v) 
{
if (v.getId() == R.id.up_button) 
{
RelativeLayout baseLayout = 
(RelativeLayout)findViewById(R.id.base_layout); 

// Must grab references to child widgets *before* calling 
removeAllViews(). 
Button upButton = (Button)findViewById(R.id.up_button); // Or just use 
‘v’ in this case. 
Button downButton = (Button)findViewById(R.id.down_button); 
ImageView imageToMove = (ImageView)findViewById(R.id.my_image); 

// *Now* it's safe to remove them, as we keep them in existence by 
// our references above. 
baseLayout.removeAllViews(); // Clears all widgets. 

// Grab existing layout params - we want to keep the same dimensions 
// but reset any rules and add our own replacement rules for 
sequencing. 

RelativeLayout.LayoutParams params = 
(RelativeLayout.LayoutParams)imageToMove.getLayoutParams(); 
params = new RelativeLayout.LayoutParams(params.width, params.height); 
// Same dimensions, no rules. 
imageToMove.setLayoutParams(params); // No rules = at the top now. 

params = (RelativeLayout.LayoutParams)upButton.getLayoutParams(); 
params = new RelativeLayout.LayoutParams(params.width, params.height); 
// Same dimensions, no rules. 
params.addRule(RelativeLayout.BELOW, imageToMove.getId() ); 
upButton.setLayoutParams(params); // Now below image. 

params = (RelativeLayout.LayoutParams)downButton.getLayoutParams(); 
params = new RelativeLayout.LayoutParams(params.width, params.height); 
// Same dimensions, no rules. 
params.addRule(RelativeLayout.BELOW, upButton.getId() ); 
downButton.setLayoutParams(params); // Now below upButton. 

baseLayout.requestLayout(); // We changed stuff, need it to lay itself 
out again. 

}

}

-- 
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

  1   2   >