[android-developers] Weird flickering with DashPathEffect animation
I'm trying to make a path animation with DashPathEffect. Have to be able to replay it multiple times, using a button. Targeting KitKat. Based on http://www.curious-creature.org/2013/12/21/android-recipe-4-path-tracing/ My problem is, the animation works well the first 10 times or so, then the path goes crazy and it starts flickering, going in the reverse order or finishes where it doesn't have to. I logged the values of the animation and the values passed to the path and they look correct, no jumps or anything weird. I have no idea what is causing the issues. *This is the code:* public class Test extends View { private float mDrag; private MyPath path1; private int mDuration; //just some shape private static Path makeDragPath(int radius) { Path p = new Path(); RectF oval = new RectF(10.0f, 10.0f, radius * 2.0f, radius * 2.0f); float cx = oval.centerX(); float cy = oval.centerY(); float rx = oval.width() / 2.0f; float ry = oval.height() / 2.0f; final float TAN_PI_OVER_8 = 0.414213562f; final float ROOT_2_OVER_2 = 0.707106781f; float sx = rx * TAN_PI_OVER_8; float sy = ry * TAN_PI_OVER_8; float mx = rx * ROOT_2_OVER_2; float my = ry * ROOT_2_OVER_2; float L = oval.left; float T = oval.top; float R = oval.right; float B = oval.bottom; p.moveTo(R, cy); p.quadTo( R, cy + sy, cx + mx, cy + my); p.quadTo(cx + sx, B, cx, B); p.quadTo(cx - sx, B, cx - mx, cy + my); p.quadTo(L, cy + sy, L, cy); p.quadTo( L, cy - sy, cx - mx, cy - my); p.quadTo(cx - sx, T, cx, T); return p; } public Test(Context context, AttributeSet attrs) { super(context, attrs); init(); } public static class MyPath { private static final Region sRegion = new Region(); private static final Region sMaxClip = new Region( Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); final Path path; final Paint paint; final float length; final Rect bounds; MyPath(Path path, Paint paint) { this.path = path; this.paint = paint; PathMeasure measure = new PathMeasure(path, false); this.length = measure.getLength(); sRegion.setPath(path, sMaxClip); bounds = sRegion.getBounds(); } } private static PathEffect createPathEffect2(float pathLength, float phase) { int startOffset = 200; float empty = Math.min(phase * pathLength, startOffset); float full = phase * pathLength; float rest = pathLength - empty - full; return new DashPathEffect(new float[] {full, Float.MAX_VALUE}, //on, off 0); } ObjectAnimator current; public void startAnim() { if (current != null) { current.cancel(); } current = ObjectAnimator.ofFloat(Test.this, drag, 0.0f, 1.0f).setDuration(mDuration); current.start(); } private void scalePath(Path path, float scale) { Matrix scaleMatrix = new Matrix(); scaleMatrix.setScale(scale, scale); path.transform(scaleMatrix); } private void init() { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(8.0f); paint.setColor(0x); mDuration = 3000; Path p1 = makeDragPath(40); scalePath(p1, 3); path1 = new MyPath(p1, paint); startAnim(); } public float getDrag() { return mDrag; } public void setDrag(float drag) { mDrag = drag; path1.paint.setPathEffect(createPathEffect2(path1.length, mDrag)); invalidate(); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawColor(Color.BLACK); //doesn't help canvas.drawPath(path1.path, path1.paint); } } *In my activity:* @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); final Test test =
[android-developers] Re: Weird flickering with DashPathEffect animation
A method needs cleanup. Removed test code and added an explanation: private static PathEffect createPathEffect2(float pathLength, float phase) { //I modified the original approach using phase, to use only path instead because later I want to animate also the starting point and phase alone is not enough for this float full = phase * pathLength; return new DashPathEffect(new float[] {full, Float.MAX_VALUE}, //on, off 0); } Am Mittwoch, 16. Juli 2014 23:27:48 UTC+2 schrieb user123: I'm trying to make a path animation with DashPathEffect. Have to be able to replay it multiple times, using a button. Targeting KitKat. Based on http://www.curious-creature.org/2013/12/21/android-recipe-4-path-tracing/ My problem is, the animation works well the first 10 times or so, then the path goes crazy and it starts flickering, going in the reverse order or finishes where it doesn't have to. I logged the values of the animation and the values passed to the path and they look correct, no jumps or anything weird. I have no idea what is causing the issues. *This is the code:* public class Test extends View { private float mDrag; private MyPath path1; private int mDuration; //just some shape private static Path makeDragPath(int radius) { Path p = new Path(); RectF oval = new RectF(10.0f, 10.0f, radius * 2.0f, radius * 2.0f); float cx = oval.centerX(); float cy = oval.centerY(); float rx = oval.width() / 2.0f; float ry = oval.height() / 2.0f; final float TAN_PI_OVER_8 = 0.414213562f; final float ROOT_2_OVER_2 = 0.707106781f; float sx = rx * TAN_PI_OVER_8; float sy = ry * TAN_PI_OVER_8; float mx = rx * ROOT_2_OVER_2; float my = ry * ROOT_2_OVER_2; float L = oval.left; float T = oval.top; float R = oval.right; float B = oval.bottom; p.moveTo(R, cy); p.quadTo( R, cy + sy, cx + mx, cy + my); p.quadTo(cx + sx, B, cx, B); p.quadTo(cx - sx, B, cx - mx, cy + my); p.quadTo(L, cy + sy, L, cy); p.quadTo( L, cy - sy, cx - mx, cy - my); p.quadTo(cx - sx, T, cx, T); return p; } public Test(Context context, AttributeSet attrs) { super(context, attrs); init(); } public static class MyPath { private static final Region sRegion = new Region(); private static final Region sMaxClip = new Region( Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); final Path path; final Paint paint; final float length; final Rect bounds; MyPath(Path path, Paint paint) { this.path = path; this.paint = paint; PathMeasure measure = new PathMeasure(path, false); this.length = measure.getLength(); sRegion.setPath(path, sMaxClip); bounds = sRegion.getBounds(); } } private static PathEffect createPathEffect2(float pathLength, float phase) { int startOffset = 200; float empty = Math.min(phase * pathLength, startOffset); float full = phase * pathLength; float rest = pathLength - empty - full; return new DashPathEffect(new float[] {full, Float.MAX_VALUE}, //on, off 0); } ObjectAnimator current; public void startAnim() { if (current != null) { current.cancel(); } current = ObjectAnimator.ofFloat(Test.this, drag, 0.0f, 1.0f).setDuration(mDuration); current.start(); } private void scalePath(Path path, float scale) { Matrix scaleMatrix = new Matrix(); scaleMatrix.setScale(scale, scale); path.transform(scaleMatrix); } private void init() { Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(8.0f); paint.setColor(0x); mDuration = 3000; Path p1 = makeDragPath(40); scalePath(p1, 3); path1 = new MyPath(p1, paint); startAnim
[android-developers] Re: Preserve WebView inputs on configuration changes, on a fragment based application?
I just got another idea! lock the orientation change in the WebView :) It's kinda bad UX but if there's no good solution I would go for that. At least better than lose the inputs... Am Samstag, 1. März 2014 23:25:16 UTC+1 schrieb user123: Hi, I'm working in a fragment based app. It has only 1 activity. The activity is used as frame and for the ActionBar etc. The different screens are implemented as fragments. We are using a combination of setRetainInstance(true), to preserve the state of the fragment (e.g. data which was already downloaded from web service), and recreate the views normally in onCreateView(), in order to use different layout for phone and tablet. Ok, works great! App is finished. But we have a WebView form. Now when the device is rotated, and onCreateView() is called, the data which was entered in the form disappears. I have to fix this. Possible solutions: 1. I found is possible to read and write the input fields using javascript. This is not usable for us, since WebView content can change and we don't can be certain about which inputs are there, which ids, etc. 2. Hold the WebView as an instance variable of the fragment - since the fragment is not recreated, thanks to setRetainInstance(true), I would expect it still holds the inputs. In onCreateView I check if the variable is null, If yes create / inflate it, then always add it as child of container FrameLayout from XML. Well, it doesn't help. With this also the inputs are lost on orientation change. 3. Declare configChanges=orientation in the manifest. But this is also very bad, because it affects the activity and thus all our app. I would have to implement onConfigurationChanged in my fragments and emulating there what's currently being done by onCreateView() - recreate the views, restore state in views, etc. So well, I have 3 solutions, 1. Not usable, 2. Doesn't work, 3. Don't know how to do it / it's probably a mess and don't want to break my code base. But I have to do it cause it's super-important for managers that the WebView retains the inputs and I think they don't care if I have to mess up the whole app because of that. Any ideas? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Preserve WebView inputs on configuration changes, on a fragment based application?
Hi, I'm working in a fragment based app. It has only 1 activity. The activity is used as frame and for the ActionBar etc. The different screens are implemented as fragments. We are using a combination of setRetainInstance(true), to preserve the state of the fragment (e.g. data which was already downloaded from web service), and recreate the views normally in onCreateView(), in order to use different layout for phone and tablet. Ok, works great! App is finished. But we have a WebView form. Now when the device is rotated, and onCreateView() is called, the data which was entered in the form disappears. I have to fix this. Possible solutions: 1. I found is possible to read and write the input fields using javascript. This is not usable for us, since WebView content can change and we don't can be certain about which inputs are there, which ids, etc. 2. Hold the WebView as an instance variable of the fragment - since the fragment is not recreated, thanks to setRetainInstance(true), I would expect it still holds the inputs. In onCreateView I check if the variable is null, If yes create / inflate it, then always add it as child of container FrameLayout from XML. Well, it doesn't help. With this also the inputs are lost on orientation change. 3. Declare configChanges=orientation in the manifest. But this is also very bad, because it affects the activity and thus all our app. I would have to implement onConfigurationChanged in my fragments and emulating there what's currently being done by onCreateView() - recreate the views, restore state in views, etc. So well, I have 3 solutions, 1. Not usable, 2. Doesn't work, 3. Don't know how to do it / it's probably a mess and don't want to break my code base. But I have to do it cause it's super-important for managers that the WebView retains the inputs and I think they don't care if I have to mess up the whole app because of that. Any ideas? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Wifi direct or bluetooth without invitations?
Is it possible to skip the invitation process in Wifi direct of bluetooth connections? If for example I have a chatroom, where one user acts as the host, with 50 people, I just want that they just do discovery, see the name of the host, select it - and can join directly. I don't want that the host has to tap 50x on accept invite. Also, maybe depending on the answer for the previous question, are there any mechanisms to define an allowed group of people - besides sharing a password with them? I'm asking for wifi direct and bluetooth because I don't know yet what I will use to implement this functionality. I tend to prefer peer to peer because greater range and if I read correctly it doesn't limit the number of peer like bluetooth. But bluetooth also could also be used. Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Wifi direct or bluetooth share information without user?
Is it possible that, using any connectivity technology, unknown devices can share information between without the user is controlling it? It would be an app where the user previously gives permission to do so, and which information is shareable. Then if 2 or more nearby devices have this app installed, they will share this information by themselves. So far I ran the sdk demos for bluetooth and wifi direct. I think the discovery process can be automated... in bluetooth at least it's possible to pass 0 to be always discoverable. But still I need to confirm the connection to/from the other devices. Is it possible to skip this? I have a preference for wifi direct answer because of range and it seems to be better generally. -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: How do I call a service, to retrieve data, from a content provider?
Thanks. I also suspected that I'm overcomplicating it :) The thing is, basically, that I saw this approach using a service in a Google IO talk about REST services (from 2010). Also, some code I worked with recently also used a service (but without content provider or database access). I thought this must have a reason, otherwise Loader or AsyncTask looks far more handy. Or in my case just calling it synchronously in the same thread where I'm accessing the content provider. Recently I also read that the service is killed similarly to the activities when e.g. the system is low of memory. So it seems there's also not a higher reliability. In other words, I have no idea why this talk showed the use of services so frequently. Maybe because it's old (although at that time there were at least threads, and that's still more use friendly to call webservices than a service). The code I received, were there were also services, I guess this company also was inspired by the same talk. Still I'm curious if there's a real reason to use a service only to call a webservice? Maybe somebody sees a point which I'm missing. Am Dienstag, 20. August 2013 08:42:36 UTC+2 schrieb Piren: Because I want that once started, it will receive and process the response, even if the user exits the app / the system kills it, etc. That has nothing to do with Services though... any ASyncTask you start or any Thread you start will continue even if you exit the app. Services die just like any other component once you Kill the app (with the exception of sliding an app from the Recents list and the service being a Foreground service). You're over complicating things... process the information on the same component that retrieves it or at least store it for whatever comes next. Also, if the web call needs to download a lot of information, it's best to implement a chunking mechanism and support being able to resume download, killing your app will have less of an impact. On Monday, August 19, 2013 10:27:29 PM UTC+3, user123 wrote: I'm trying to implement a pattern of accessing data source, independently if it's local or remote, using a content provider. So, inside the content provider, for example in the query method: public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {...} I want to, check if data is stored locally, if not, then call the webservice, on response save and return it. Typical request process with a local cache. Now to get the data from the webservice, I wanted to use a service. Because I want that once started, it will receive and process the response, even if the user exits the app / the system kills it, etc. Note: I don't need to use anything synchronous here, since I'm already running the query to the content provider asynchronouly (AsyncQueryHandler). So I think I have to use Service instead of e.g. IntentService. The idea with the service is to have a method to call the webservice: public WebserviceResponse callWebservice(params) {...} And in ContentProvider.query(): WebserviceResponse response = myService.callWebservice(params); But the problem is that I can't find how to ensure that the service is already bound before the first query. If I bind it in ContentProvider.onCreate: @Override public boolean onCreate() { final Context context = getContext(); dbHelper = new DatabaseHelper(context); context.bindService(new Intent(context, MyService.class), mConnection, Context.BIND_AUTO_CREATE); return true; } Where mConnection is: private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder binder) { myService = ((MyService.MyBinder) binder).getService(); } public void onServiceDisconnected(ComponentName className) { myService = null; } }; And I do a query using this content provider in my activity's onCreate(), the service is not bound yet and I get an exception when I try to use it. A way around I can think of, is to call the webservice directly - without a service - from the content provider. This will be synchronous and I can process the response without problems there. But it has mentioned disadvantage that the call can be interrupted and the data not processed. It's not the end of the world - the next time the user opens the app, the webservice would be called again. But I still would like to not have it that way. A second possibility I can think of, is to invert this logic and do the access to the content provider in a (asynchronous) service. But here I have a different problem, which is that, afair, the async service (IntentService) communicates with the caller though with IPC and this is not supposed to pass large amounts of data. So I would have again to wrap this in some other logic which after service
[android-developers] How do I call a service, to retrieve data, from a content provider?
I'm trying to implement a pattern of accessing data source, independently if it's local or remote, using a content provider. So, inside the content provider, for example in the query method: public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {...} I want to, check if data is stored locally, if not, then call the webservice, on response save and return it. Typical request process with a local cache. Now to get the data from the webservice, I wanted to use a service. Because I want that once started, it will receive and process the response, even if the user exits the app / the system kills it, etc. Note: I don't need to use anything synchronous here, since I'm already running the query to the content provider asynchronouly (AsyncQueryHandler). So I think I have to use Service instead of e.g. IntentService. The idea with the service is to have a method to call the webservice: public WebserviceResponse callWebservice(params) {...} And in ContentProvider.query(): WebserviceResponse response = myService.callWebservice(params); But the problem is that I can't find how to ensure that the service is already bound before the first query. If I bind it in ContentProvider.onCreate: @Override public boolean onCreate() { final Context context = getContext(); dbHelper = new DatabaseHelper(context); context.bindService(new Intent(context, MyService.class), mConnection, Context.BIND_AUTO_CREATE); return true; } Where mConnection is: private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder binder) { myService = ((MyService.MyBinder) binder).getService(); } public void onServiceDisconnected(ComponentName className) { myService = null; } }; And I do a query using this content provider in my activity's onCreate(), the service is not bound yet and I get an exception when I try to use it. A way around I can think of, is to call the webservice directly - without a service - from the content provider. This will be synchronous and I can process the response without problems there. But it has mentioned disadvantage that the call can be interrupted and the data not processed. It's not the end of the world - the next time the user opens the app, the webservice would be called again. But I still would like to not have it that way. A second possibility I can think of, is to invert this logic and do the access to the content provider in a (asynchronous) service. But here I have a different problem, which is that, afair, the async service (IntentService) communicates with the caller though with IPC and this is not supposed to pass large amounts of data. So I would have again to wrap this in some other logic which after service is finished checks a flag and retrieves data, this time directly from the content provider. This would also mean to start a second async query. I already came up with an architecture that works, but it's quite complex. It: 1. Does async query to the content provider 2. If there's no data, starts an IntentService to get it from remote. 3. After the service finishes it returns a flag, and then, does again async query to get the data which was saved by the webservice. I would like to simplify it, that's why I'm asking this. So is there any way that I can use the service in the content provider, or any other approach, or advice you would recommend? -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Fragments navigation and backstack issue
Hi, thanks. This is not quite what I need, but the OnBackStackChangedListener could be useful. I ended just enabling the default behaviour of letting the backstack increase endlessly when the user switches screens with the navigation. Somebody in StackOverflow adviced this, in order to not confuse the users. On the other side I think it's bad if the app crashes because out of memory. But I let it like that because I hadn't more time. Am Sonntag, 4. August 2013 18:13:56 UTC+2 schrieb Nobu Games: Hi! I remember the pain with fragments and the back stack while working on an app last year. My solution was the following. In the activity's onCreate method I would do the following: FragmentManager fm = getSupportFragmentManager(); fm.addOnBackStackChangedListener(new OnBackStackChangedListener() { @Override public void onBackStackChanged() { FragmentManager fm = getSupportFragmentManager(); if(fm.getBackStackEntryCount() == 0) { finish(); } } }); It basically listens to fragment back stack changes and forces the Activity to finish when the stack is empty On Sunday, August 4, 2013 4:47:47 AM UTC-5, user123 wrote: Im trying to implement a fragment based navigation pattern, which can be reduced to this: https://lh4.googleusercontent.com/-Ws0I4LcPFNA/Uf4irMURI3I/A0s/D1wYtJBCwXc/s1600/screen2.png https://lh4.googleusercontent.com/-4CuK_LmDSxA/Uf4iuRVg4cI/A00/ht6e2Pt1y48/s1600/sk.png In words: There is: - Home fragment - Fragment A - Fragment B The fragments are shown in FrameLayout content. The navigation bar is part of the activity. Workflow should be: Press back on home: Exit App. Press back on A or B: show Home. Most of it works as it should, but I have the problem that with a complex workflow like this: Start(home) - A - B - A - Back - B - Back I expect that it will show home, but instead it shows A. I think it's because the first transaction (home - A) it's in the backstack and it shows A. But I don't understand why then it works correctly in the simple cases? The code: public class MainActivity extends FragmentActivity { boolean isInHome; //a flag to control when we add fragment to the backstack or not @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //set home fragment programmatically first time FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentHome = new FragmentHome(); transaction.replace(R.id.content, fragmentHome); transaction.commit(); isInHome = true; //initialize layout Button home = (Button) findViewById(R.id.home); Button a = (Button) findViewById(R.id.a); Button b = (Button) findViewById(R.id.b); home.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //clear complete backstack (in this case, just pop home transaction) getSupportFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); //show home fragment FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentHome = new FragmentHome(); transaction.replace(R.id.content, fragmentHome); transaction.commit(); isInHome = true; } }); a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentA = new FragmentA(); transaction.replace(R.id.content, fragmentA); if (isInHome) { //add the home transaction to the backstack, such that press back on this fragment shows home again transaction.addToBackStack(home); } transaction.commit(); isInHome = false; } }); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentB = new FragmentB(); transaction.replace(R.id.content, fragmentB); if (isInHome) { //add the home transaction to the backstack, such that press back on this fragment shows home again transaction.addToBackStack(home); } transaction.commit(); isInHome = false; } });} @Overridepublic void onBackPressed() { super.onBackPressed(); isInHome = true; //quick solution to update status - when press back on A or B, we
[android-developers] Re: Wrong UTF-8 encoding when getting string programmatically
Update: The problem was that I was using a custom font and this didn't contain these special chars. There was actually no difference between xml/programmatically, I was testing incorrectly. Am Mittwoch, 17. Juli 2013 12:58:43 UTC+2 schrieb user123: I have a strange issue with vietnamese translations. They're stored in strings.vi file, in the app. The translations which are attached to TextView directly in the layout files display correctly, but if I get them programmatically: `getString(R.string.foo)`, then some of the vietnamese special chars display question marks (with squares). I checked: - Translations file saved in UTF-8 - Workspace uses UTF-8 I also tried: textView.setText(new String(getString(R.string.foo).getBytes(), UTF-8)); But nothing helps, still get these question marks. I tried also setting ISO-8859-1 in getBytes - basically because I found this in some other thread but it doesn't make really sense, since the characters should be saved in UTF-8 (and otherwise, I don't know how they are stored). textView.setText(new String(getString(R.string.foo).getBytes(ISO-8859-1), UTF-8)); This changed the result a bit, got bigger questions marks but still showing incorrectly. I also tried changing the enconding of the xml file to UTF-16, or use UTF-16 in getString, but then everything was displayed in something I believe is Chinese. Any ideas? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: How can I identify permanently certain builds of my app (for tracking)?
Update: There is a flag to detect if the app was preinstalled: ApplicationInfo.FLAG_SYSTEM Am Dienstag, 9. Juli 2013 22:38:42 UTC+2 schrieb user123: I need to identify certain builds of my app permanently. The reason is, that these will be pre-installed in certain devices and they need some different tracking parameters. I don't want to create a new app for this - the app has to be the same as the normal one, which can be downloaded from Google Play. Before any app update, the solution is clear - just create 2 different builds, with same package name and signature, one goes directly to be preinstalled on the devices and other to Google Play. But the preinstalled apps have to receive updates, and AFAIK, all differences will be overwritten. Possible solutions which come to my mind: - Pre-installed build saves a preference. Problem: the user can clear the preferences at any moment. This has to be reliable. - Server side identification. Problem: the app doesn't require user login to be used - so there would be only left the IMEI, which has to be sent to the server the first time to say I'm preinstalled, but this would need server changes, which are unwanted + not sure about legal implications of sending IMEI (maybe a hash - but still, this isn't nice). - Identify the app through the place it's stored. But I don't know where people will store these pre installed apps. I assume they go in the same place as normal apps. They are not system apps / firmware. So I guess this is also not a possibility. - Different settings in the manifest: The whole manifest, as well as the code, seems to be overwritten on updates, so I guess this is also not a possibility. Is there any other way to identify my installation subset. Maybe I'm missing something very basic. Or what do you advice, generally? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: WebView numeric keyboard from HTML
Yes, thanks, no idea, I think it's working now, probably there was a period of time where the HTML (written by someone else) was incorrect. Am Mittwoch, 5. Juni 2013 18:22:00 UTC+2 schrieb MagouyaWare: I don't know if this will help in your case or not, but I found this after doing some searching on google: http://stackoverflow.com/questions/8333117/is-there-a-way-to-have-a-masked-numeric-input-field Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Wed, May 22, 2013 at 3:09 AM, user123 ivans...@gmail.com javascript: wrote: Any update on this? I have input fields in webview with type=number but still get normal soft keyboard - showing letters first. Am Freitag, 14. Januar 2011 15:14:39 UTC+1 schrieb linhadiretalipe: Hi, I have a input in a WebView and I would like to know how can I call keyboard with only numeric buttons? tks, -- Filipe B. da S. Ferreira -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Fragments navigation and backstack issue
Im trying to implement a fragment based navigation pattern, which can be reduced to this: https://lh4.googleusercontent.com/-Ws0I4LcPFNA/Uf4irMURI3I/A0s/D1wYtJBCwXc/s1600/screen2.png https://lh4.googleusercontent.com/-4CuK_LmDSxA/Uf4iuRVg4cI/A00/ht6e2Pt1y48/s1600/sk.png In words: There is: - Home fragment - Fragment A - Fragment B The fragments are shown in FrameLayout content. The navigation bar is part of the activity. Workflow should be: Press back on home: Exit App. Press back on A or B: show Home. Most of it works as it should, but I have the problem that with a complex workflow like this: Start(home) - A - B - A - Back - B - Back I expect that it will show home, but instead it shows A. I think it's because the first transaction (home - A) it's in the backstack and it shows A. But I don't understand why then it works correctly in the simple cases? The code: public class MainActivity extends FragmentActivity { boolean isInHome; //a flag to control when we add fragment to the backstack or not @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //set home fragment programmatically first time FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentHome = new FragmentHome(); transaction.replace(R.id.content, fragmentHome); transaction.commit(); isInHome = true; //initialize layout Button home = (Button) findViewById(R.id.home); Button a = (Button) findViewById(R.id.a); Button b = (Button) findViewById(R.id.b); home.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //clear complete backstack (in this case, just pop home transaction) getSupportFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); //show home fragment FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentHome = new FragmentHome(); transaction.replace(R.id.content, fragmentHome); transaction.commit(); isInHome = true; } }); a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentA = new FragmentA(); transaction.replace(R.id.content, fragmentA); if (isInHome) { //add the home transaction to the backstack, such that press back on this fragment shows home again transaction.addToBackStack(home); } transaction.commit(); isInHome = false; } }); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragmentB = new FragmentB(); transaction.replace(R.id.content, fragmentB); if (isInHome) { //add the home transaction to the backstack, such that press back on this fragment shows home again transaction.addToBackStack(home); } transaction.commit(); isInHome = false; } });} @Overridepublic void onBackPressed() { super.onBackPressed(); isInHome = true; //quick solution to update status - when press back on A or B, we are in home (and press back in home exits the app, so this doesn't matter)} } What's wrong here? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Wrong UTF-8 encoding when getting string programmatically
I have a strange issue with vietnamese translations. They're stored in strings.vi file, in the app. The translations which are attached to TextView directly in the layout files display correctly, but if I get them programmatically: `getString(R.string.foo)`, then some of the vietnamese special chars display question marks (with squares). I checked: - Translations file saved in UTF-8 - Workspace uses UTF-8 I also tried: textView.setText(new String(getString(R.string.foo).getBytes(), UTF-8)); But nothing helps, still get these question marks. I tried also setting ISO-8859-1 in getBytes - basically because I found this in some other thread but it doesn't make really sense, since the characters should be saved in UTF-8 (and otherwise, I don't know how they are stored). textView.setText(new String(getString(R.string.foo).getBytes(ISO-8859-1), UTF-8)); This changed the result a bit, got bigger questions marks but still showing incorrectly. I also tried changing the enconding of the xml file to UTF-16, or use UTF-16 in getString, but then everything was displayed in something I believe is Chinese. Any ideas? Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Delete unpublished apk from Google Play is not possible
I have a very stupid problem. We created an application in Google Play, somebody else filled with all required information - translations, screenshots, etc. Now for testing reasons, we uploaded the first .apk with a different package name (another already existent app). The question: How can I delete this .apk!? It seems not to be possible! I only find an option to delete the application, but I guess that this will delete the whole thing, the descriptions, screenshots, etc. When I try to upload .apk with the correct package name, it says, I can't, because the package name has to be the same. Thanks -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Delete unpublished apk from Google Play is not possible
I recreated the app, seems its the only way. Am Dienstag, 9. Juli 2013 14:07:07 UTC+2 schrieb user123: I have a very stupid problem. We created an application in Google Play, somebody else filled with all required information - translations, screenshots, etc. Now for testing reasons, we uploaded the first .apk with a different package name (another already existent app). The question: How can I delete this .apk!? It seems not to be possible! I only find an option to delete the application, but I guess that this will delete the whole thing, the descriptions, screenshots, etc. When I try to upload .apk with the correct package name, it says, I can't, because the package name has to be the same. Thanks -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] How can I identify permanently certain builds of my app (for tracking)?
I need to identify certain builds of my app permanently. The reason is, that these will be pre-installed in certain devices and they need some different tracking parameters. I don't want to create a new app for this - the app has to be the same as the normal one, which can be downloaded from Google Play. Before any app update, the solution is clear - just create 2 different builds, with same package name and signature, one goes directly to be preinstalled on the devices and other to Google Play. But the preinstalled apps have to receive updates, and AFAIK, all differences will be overwritten. Possible solutions which come to my mind: - Pre-installed build saves a preference. Problem: the user can clear the preferences at any moment. This has to be reliable. - Server side identification. Problem: the app doesn't require user login to be used - so there would be only left the IMEI, which has to be sent to the server the first time to say I'm preinstalled, but this would need server changes, which are unwanted + not sure about legal implications of sending IMEI (maybe a hash - but still, this isn't nice). - Identify the app through the place it's stored. But I don't know where people will store these pre installed apps. I assume they go in the same place as normal apps. They are not system apps / firmware. So I guess this is also not a possibility. - Different settings in the manifest: The whole manifest, as well as the code, seems to be overwritten on updates, so I guess this is also not a possibility. Is there any other way to identify my installation subset. Maybe I'm missing something very basic. Or what do you advice, generally? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Soft keyboard in webview - no “next” button to tab between input fields
Nobody with experience on this? Similar problem? Am Mittwoch, 22. Mai 2013 11:16:02 UTC+2 schrieb user123: My soft keyboad doesn't show this button when I focus webview input fields. Don't find anything about special settings to enable this - am I missing something? It doesn't appear in any kind of input field. Shouldn't this button appear by default? Android version 4.0.3 -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] type=number on webview doesn't show numeric keyboard
I have a webview with input fields with attribute type=number, according to docs this should open numeric keyboard. I just get qwerty like with the rest of fields. Does this need additional development effort? Or is it the device maybe? (I'm using Galaxy S2, Android 4.0)? -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: WebView numeric keyboard from HTML
Any update on this? I have input fields in webview with type=number but still get normal soft keyboard - showing letters first. Am Freitag, 14. Januar 2011 15:14:39 UTC+1 schrieb linhadiretalipe: Hi, I have a input in a WebView and I would like to know how can I call keyboard with only numeric buttons? tks, -- Filipe B. da S. Ferreira -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Soft keyboard in webview - no “next” button to tab between input fields
My soft keyboad doesn't show this button when I focus webview input fields. Don't find anything about special settings to enable this - am I missing something? It doesn't appear in any kind of input field. Shouldn't this button appear by default? Android version 4.0.3 -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
I didn't create a release keystore because I have not released yet, and I didn't need it. I was using the debug keystore. I created the release keystore when I was finished, to put the app in Google Play. Am Dienstag, 30. April 2013 04:12:34 UTC+2 schrieb Ian Ni-Lewis: I agree, you should have been notified. I do not know why you weren't. I don't understand the issue with the debug certificate. Do you not have a valid release key certificate that you can use for development? Ian On Fri, Apr 26, 2013 at 6:59 AM, Craig Payne craig@gmail.comjavascript: wrote: Not quite true, Ian. I am trying to fix a bug in an app I released over a year ago, and my debug.keystore certificate has expired. Given that this is the default behaviour (365 day expiry), most developers are not going to be able to use their old API keys to continue development for very long. I need to make a tiny change, and to do this I will be forced to upgrade to v2, which means I can no longer support Android 1.6. This will immediately cut out 8% of my users, who will loudly complain and give me bad reviews in Google Play. They are not able to upgrade because of fragmentation, and are stuck with an old version of Android, which up to now I have been able to support. I didn't see the clear communications that this would be deprecated either, and I pay special attention to emails from Google. I WAS told by Google that the v2 web-based maps would be deprecated and DID update them in time. While I might expect something like this from the cowboys at Facebook, I hold Google to a higher standard and I am shocked and disappointed. It sounds like you're actually from Google, so do you have any solution for us developers who are trying to support Android, but who have existing keys with expired debug certificates? In any case, you appear to be assuming that we shut down a service without informing its users. This is not the case. We stopped accepting new users into a service which we intend to keep online for a period of several years. No existing users were affected by this change. No users who obtained an API key before beginning development (as they were clearly instructed to do) should have been affected. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Android Developers group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-developers/R2dwCWyC3TQ/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Ian Ni-Lewis Staff Developer Programs Engineer Android Developer Relations -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
I have a key but for the debug keystore. That is what I was using during development. I didn't know that I need a new key for the release keystore. Probably I just missed that information - or thought that I would get it when I release (I don't remember). Am Donnerstag, 25. April 2013 07:11:41 UTC+2 schrieb Ian Ni-Lewis: On Wed, Apr 24, 2013 at 4:01 PM, Indicator Veritatis mej...@yahoo.comjavascript: wrote: There is a world of a difference, Ian, between updating our software and completely breaking an entire set of APIs. Google did the latter. Many other companies instead keep the old APIs working for years, encouraging developers to develop only for the new API set. But we *are* keeping the old APIs working for years. The deprecation is following the normal Google policy. Existing users will be supported for some time to come--something on the order of three years, if I recall correctly. What we're not doing is issuing new keys. I'm unable to think of a way of deprecating an API that's significantly more fair than that. Now Google may have had a good reason for completely scrapping v1 and forcing everyone to migrate to v2 with no backwards compatibility -- but did Google ever communicate this to developers? I never saw this. Evidently, neither did a number of contributors to this thread. We did communicate this via G+ and a fairly prominent paragraph on the Maps API page. We probably could have done more communicating directly from the Android team. As it was, we let the Maps team communicate the change, and perhaps missed many Android developers. Finally, why are you even asking if he got a v1 API key? Even his first post should have made it clear that he got further than that in the development process. For you to insinuate that he did not even get this far shows both laziness on your part and contempt for Google's customers and partners, developers. I think you're being overly harsh with me and overly kind to the OP. I'm not familiar with his development process, but I'm fairly certain that had he requested a key, it would still be operational (see my comments about the deprecation policy, above). If I understood the original post, the developer claimed that he fully developed an app, waited for a period of several months, and then requested a key just before he intended to go live. Perhaps he used someone else's key during development? In any case, you appear to be assuming that we shut down a service without informing its users. This is not the case. We stopped accepting new users into a service which we intend to keep online for a period of several years. No existing users were affected by this change. No users who obtained an API key before beginning development (as they were clearly instructed to do) should have been affected. Hence, my question. If the OP has a key that is not working, then I will do everything within my power to fix that for him. However, it appears that what he has is no key, and no plausible reason for why he didn't obtain a key when it was possible for him to do so. That's significantly more difficult for me to fix. Thanks Ian On Tuesday, April 23, 2013 8:38:09 AM UTC-7, Ian Ni-Lewis wrote: You say that My career doesn't revolve around only Google, and I have other things to do than checking each x months if one API has been discontinuated and I need to develop everything again. We do occasionally need to update our software, and although we do try very hard to avoid breaking changes, they do sometimes happen. How would you prefer to be notified of these changes? Have you ever obtained a v1 API key or uploaded an app to Google Play? If not, then how would Google have communicated this important information to you? Ian On Tuesday, April 23, 2013 2:59:07 AM UTC-7, user123 wrote: Yes, in moments like this, I ask myself why I'm an Android developer :) I think I started basically because I didn't/don't like Apple. But reconsidering this position. Another thing I found quite annoying during this experience, is that there's not even a direct contact possibility. All I found was an email Address of Googe Play, then I got an automatic e-Mail in response, which told me, to answer directly if this doesn't solve the problem, I did, and then I got: Thank you for your note. If you're looking for information regarding Google Maps Android API, please visit our Google Play Android Developer site: http://developer.android.com/**google/play-services/maps.htmlhttp://developer.android.com/google/play-services/maps.html ** I probably can't call this bad costumer service, since I'm only a stupid developer, not a costumer, and I don't deserve any direct communication with Google. And not to dream about the possibility to get some human-generated consideration about my case and a key for v1. And I'm not afraid of writing this, because
Re: [android-developers] Maps api key v1?
I have a key but for the debug keystore. That is what I was using during development. I didn't think about that I need a new key for the release keystore. Or probably I let it for later (don't remember), since I also hadn't created the release keystore. Am Donnerstag, 25. April 2013 07:11:41 UTC+2 schrieb Ian Ni-Lewis: On Wed, Apr 24, 2013 at 4:01 PM, Indicator Veritatis mej...@yahoo.comjavascript: wrote: There is a world of a difference, Ian, between updating our software and completely breaking an entire set of APIs. Google did the latter. Many other companies instead keep the old APIs working for years, encouraging developers to develop only for the new API set. But we *are* keeping the old APIs working for years. The deprecation is following the normal Google policy. Existing users will be supported for some time to come--something on the order of three years, if I recall correctly. What we're not doing is issuing new keys. I'm unable to think of a way of deprecating an API that's significantly more fair than that. Now Google may have had a good reason for completely scrapping v1 and forcing everyone to migrate to v2 with no backwards compatibility -- but did Google ever communicate this to developers? I never saw this. Evidently, neither did a number of contributors to this thread. We did communicate this via G+ and a fairly prominent paragraph on the Maps API page. We probably could have done more communicating directly from the Android team. As it was, we let the Maps team communicate the change, and perhaps missed many Android developers. Finally, why are you even asking if he got a v1 API key? Even his first post should have made it clear that he got further than that in the development process. For you to insinuate that he did not even get this far shows both laziness on your part and contempt for Google's customers and partners, developers. I think you're being overly harsh with me and overly kind to the OP. I'm not familiar with his development process, but I'm fairly certain that had he requested a key, it would still be operational (see my comments about the deprecation policy, above). If I understood the original post, the developer claimed that he fully developed an app, waited for a period of several months, and then requested a key just before he intended to go live. Perhaps he used someone else's key during development? In any case, you appear to be assuming that we shut down a service without informing its users. This is not the case. We stopped accepting new users into a service which we intend to keep online for a period of several years. No existing users were affected by this change. No users who obtained an API key before beginning development (as they were clearly instructed to do) should have been affected. Hence, my question. If the OP has a key that is not working, then I will do everything within my power to fix that for him. However, it appears that what he has is no key, and no plausible reason for why he didn't obtain a key when it was possible for him to do so. That's significantly more difficult for me to fix. Thanks Ian On Tuesday, April 23, 2013 8:38:09 AM UTC-7, Ian Ni-Lewis wrote: You say that My career doesn't revolve around only Google, and I have other things to do than checking each x months if one API has been discontinuated and I need to develop everything again. We do occasionally need to update our software, and although we do try very hard to avoid breaking changes, they do sometimes happen. How would you prefer to be notified of these changes? Have you ever obtained a v1 API key or uploaded an app to Google Play? If not, then how would Google have communicated this important information to you? Ian On Tuesday, April 23, 2013 2:59:07 AM UTC-7, user123 wrote: Yes, in moments like this, I ask myself why I'm an Android developer :) I think I started basically because I didn't/don't like Apple. But reconsidering this position. Another thing I found quite annoying during this experience, is that there's not even a direct contact possibility. All I found was an email Address of Googe Play, then I got an automatic e-Mail in response, which told me, to answer directly if this doesn't solve the problem, I did, and then I got: Thank you for your note. If you're looking for information regarding Google Maps Android API, please visit our Google Play Android Developer site: http://developer.android.com/**google/play-services/maps.htmlhttp://developer.android.com/google/play-services/maps.html ** I probably can't call this bad costumer service, since I'm only a stupid developer, not a costumer, and I don't deserve any direct communication with Google. And not to dream about the possibility to get some human-generated consideration about my case and a key for v1. And I'm not afraid of writing this, because Google
Re: [android-developers] Maps api key v1?
Yes, in moments like this, I ask myself why I'm an Android developer :) I think I started basically because I didn't/don't like Apple. But reconsidering this position. Another thing I found quite annoying during this experience, is that there's not even a direct contact possibility. All I found was an email Address of Googe Play, then I got an automatic e-Mail in response, which told me, to answer directly if this doesn't solve the problem, I did, and then I got: Thank you for your note. If you're looking for information regarding Google Maps Android API, please visit our Google Play Android Developer site: http://developer.android.com/google/play-services/maps.html; I probably can't call this bad costumer service, since I'm only a stupid developer, not a costumer, and I don't deserve any direct communication with Google. And not to dream about the possibility to get some human-generated consideration about my case and a key for v1. And I'm not afraid of writing this, because Google will not even read it :) So I'll delay my release and post soon my questions about v2. And try my best to keep my motivation to be an Android developer. Am Dienstag, 23. April 2013 03:07:00 UTC+2 schrieb Indicator Veritatis: In your message starting this thread, you say: The context: I finished an app a few months ago. I want to release it now. Well, it appears Google has, in its infinite wisdom, decided during those few months not to give anyone a v1 key. Of course, this is inconsiderate to developers, but Google is like that. Even in its worst days, Apple had better relations with independent developers. But no doubt Google would ask, well, what were you doing in those 'few months' that you did not notice the need to update your app for the new API? Android developers have to roll with the punches and live with this kind of abuse from Google, we cannot change it. Complain if you have to to get it out of your system, but then move on. Either drop the app or rewrite it to use the new API. On Monday, April 22, 2013 3:47:10 AM UTC-7, user123 wrote: Can you please stop using this conversation (only) to promote yourself :) thanks. I can google the information myself. This is not any serious help. What I need is an API key for v1 to release my finished app. Am Montag, 22. April 2013 12:27:57 UTC+2 schrieb VenomVendor™: There is no other way, than porting to MapsV2. If you find any difficulty in anypart of MapsV2, We as a developer will support you to the best. I suggest you to post in the same thread rather than creating new thread. Before you Post, Search in StackOverflowhttp://stackoverflow.com/questions/tagged/android-maps-v2 *To start with MapsV2.* Here are few links to start with MapsV2 Getting Started with Google MapsV2http://venomvendor.blogspot.in/2013/04/getting-started-with-google-mapv2-for.html To create a custom overlay with custom typeface, I suggest you to see this Using Custom Typeface in Maps V2http://stackoverflow.com/q/15668430/1008278 If you want any help, let us know, Sharing is Caring. My Android Apps-(Rate Reviewhttps://play.google.com/store/apps/developer?id=VenomVendor ) -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
@Ibendlin Thank you for the friendly response. Who are you anyway? I would expect Google to care, at least. Hopefully I'm not asking to much. My career doesn't revolve around only Google, and I have other things to do than checking each x months if one API has been discontinuated and I need to develop everything again. @Ankita Yes, if there's no other option, I guess I have to. But big minus from my side for Google, even if nobody cares about me (which is also evidently the case / another minus). If find this respectless for developers. Great that Google advances quickly, I also saw good stuff in maps v2. But the point is that I planned this release, I was occupied with other things, and I am being forced now to delay release (how long? no idea, I don't know the new API), and then it has to be tested again, etc. Just because I didn't get an API key for production before March 18. Am Montag, 22. April 2013 10:01:34 UTC+2 schrieb Ankita: Although your efforts must have been massive with the map api v1, I guess moving to map api v2 will not be huge effort as it is much cleaner than v1. I had to move to api v2 myself from v1 while I was half-way through the development but, once I spent a day or two with it, I realised that it was very easy for example, list of markers using itemoverlay can be easily implemented using marker object which allows easy display of additional information on clicking the marker. Then, I do not know what kind of animated radius circle you have but, you can easily show polygons in new map api version. So, given you have no other option, give it a shot with a open head. On Mon, Apr 22, 2013 at 5:59 AM, lbendlin lu...@bendlin.us javascript:wrote: Nobody cares how much effort you have put in. There was plenty of warning that this would happen. Now it happened, live with it. On Sunday, April 21, 2013 5:15:07 PM UTC-4, user123 wrote: Thanks for the advice, but I also have other things to work on! And this was supposed to be released! And it's not easy map, it has a lot of custom stuff, overlays, with images downloaded from web, animatied radius circle, clustering, etc. This will not be a few minutes. Am Sonntag, 21. April 2013 10:33:03 UTC+2 schrieb VenomVendor™: It's easy you need not worry, even i had the same kind of thinking. *Check out my app in which i have used MapsV2https://play.google.com/store/apps/details?id=veevee.kfc * when i ported, i felt much easier, you have to try this. http://venomvendor.blogspot.**in/2013/04/generating-api-key-** for-google-mapsv2.htmlhttp://venomvendor.blogspot.in/2013/04/generating-api-key-for-google-mapsv2.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-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Warm Regards, Ankita Kashyap -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
Can you please stop using this conversation (only) to promote yourself :) thanks. I can google the information myself. This is not any serious help. What I need is an API key for v1 to release my finished app. Am Montag, 22. April 2013 12:27:57 UTC+2 schrieb VenomVendor™: There is no other way, than porting to MapsV2. If you find any difficulty in anypart of MapsV2, We as a developer will support you to the best. I suggest you to post in the same thread rather than creating new thread. Before you Post, Search in StackOverflowhttp://stackoverflow.com/questions/tagged/android-maps-v2 *To start with MapsV2.* Here are few links to start with MapsV2 Getting Started with Google MapsV2http://venomvendor.blogspot.in/2013/04/getting-started-with-google-mapv2-for.html To create a custom overlay with custom typeface, I suggest you to see this Using Custom Typeface in Maps V2http://stackoverflow.com/q/15668430/1008278 If you want any help, let us know, Sharing is Caring. My Android Apps-(Rate Reviewhttps://play.google.com/store/apps/developer?id=VenomVendor ) -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
My app is already finished, also with testing, there's a lot of custom stuff on maps and no plan to port all that to version 2 now. Am Samstag, 20. April 2013 23:39:13 UTC+2 schrieb rambabu mareedu: Sorry to say that there is no way to work with api v1 you should go for google maps api v2... On Sat, Apr 20, 2013 at 9:32 PM, user123 ivans...@gmail.com javascript: wrote: I need urgently a key for maps api v1. Is there any way to still get one? The context: I finished an app a few months ago. I want to release it now. Now I see that I need a new map key for the release keystore. Well, I go to the page to get the key, and it says, that I have to port my maps to version 2. I can't do that now. Release is planned now, as said, everything is finished and tested. Is there a way to still get a version 1 key!? 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-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Regards Rambabu Mareedu 9581411199 -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Maps api key v1?
Thanks for the advice, but I also have other things to work on! And this was supposed to be released! And it's not easy map, it has a lot of custom stuff, overlays, with images downloaded from web, animatied radius circle, clustering, etc. This will not be a few minutes. Am Sonntag, 21. April 2013 10:33:03 UTC+2 schrieb VenomVendor™: It's easy you need not worry, even i had the same kind of thinking. *Check out my app in which i have used MapsV2https://play.google.com/store/apps/details?id=veevee.kfc * when i ported, i felt much easier, you have to try this. http://venomvendor.blogspot.in/2013/04/generating-api-key-for-google-mapsv2.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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] setXfermode not working on pre-ICS
I have 2 images, one on top of the other. I paint a circle in the front-image with xfermode to let the image bellow show through. I realized this with 2 views in a RelativeLayout. The front-view acts as mask and is a custom view. The problem: Works well in 4.x, but on 2.x the circle is black, instead of transparent. The code: @Override public void onDraw(Canvas canvas){ super.onDraw(canvas); c2.drawCircle(X, Y, 50, pTouch); Paint new_paint = new Paint(); new_paint.setXfermode(new PorterDuffXfermode(Mode.SRC_ATOP)); rect.set (0, 0, getWidth(), getHeight()); canvas.drawBitmap(overlay, null, rect, new_paint); } And c2 was initialized to a canvas with bitmap overlay, like this: Bitmap overlay; BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; overlay = BitmapFactory.decodeResource(getResources(), R.drawable.overlay, options); //... overlay = Bitmap.createScaledBitmap(overlay, newWidth, newHeight, false); c2 = new Canvas(overlay); c2.drawBitmap(overlay, null, rect, filterPaint); Thanks! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] setXfermode not working on pre-ICS
I have 2 images, one on top of the other. I paint a circle in the front-image with xfermode to let the image bellow show through. I realized this with 2 views in a RelativeLayout. The front-view acts as mask and is a custom view. The problem: Works well in 4.x, but on 2.x the circle is black, instead of transparent. The code: @Override public void onDraw(Canvas canvas){ super.onDraw(canvas); c2.drawCircle(X, Y, 50, pTouch); Paint new_paint = new Paint(); new_paint.setXfermode(new PorterDuffXfermode(Mode.SRC_ATOP)); rect.set (0, 0, getWidth(), getHeight()); canvas.drawBitmap(overlay, null, rect, new_paint); } And c2 was initialized to a canvas with bitmap overlay, like this: Bitmap overlay; BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; overlay = BitmapFactory.decodeResource(getResources(), R.drawable.overlay, options); //... overlay = Bitmap.createScaledBitmap(overlay, newWidth, newHeight, false); c2 = new Canvas(overlay); Paint filterPaint = new Paint(); filterPaint.setColorFilter(new PorterDuffColorFilter(0xff22, PorterDuff.Mode.SRC_ATOP)); rect.set (0, 0, w, h); c2.drawBitmap(overlay, null, rect, filterPaint); Thanks! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: setXfermode not working on pre-ICS
I forgot: Initialization of pTouch (used in onDraw()): pTouch = new Paint(Paint.ANTI_ALIAS_FLAG); pTouch.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT)); pTouch.setColor(Color.TRANSPARENT); pTouch.setMaskFilter(new BlurMaskFilter(25, Blur.NORMAL)); Am Samstag, 20. April 2013 11:07:16 UTC+2 schrieb user123: I have 2 images, one on top of the other. I paint a circle in the front-image with xfermode to let the image bellow show through. I realized this with 2 views in a RelativeLayout. The front-view acts as mask and is a custom view. The problem: Works well in 4.x, but on 2.x the circle is black, instead of transparent. The code: @Override public void onDraw(Canvas canvas){ super.onDraw(canvas); c2.drawCircle(X, Y, 50, pTouch); Paint new_paint = new Paint(); new_paint.setXfermode(new PorterDuffXfermode(Mode.SRC_ATOP)); rect.set (0, 0, getWidth(), getHeight()); canvas.drawBitmap(overlay, null, rect, new_paint); } And c2 was initialized to a canvas with bitmap overlay, like this: Bitmap overlay; BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; overlay = BitmapFactory.decodeResource(getResources(), R.drawable.overlay, options); //... overlay = Bitmap.createScaledBitmap(overlay, newWidth, newHeight, false); c2 = new Canvas(overlay); Paint filterPaint = new Paint(); filterPaint.setColorFilter(new PorterDuffColorFilter(0xff22, PorterDuff.Mode.SRC_ATOP)); rect.set (0, 0, w, h); c2.drawBitmap(overlay, null, rect, filterPaint); Thanks! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Maps api key v1?
I need urgently a key for maps api v1. Is there any way to still get one? The context: I finished an app a few months ago. I want to release it now. Now I see that I need a new map key for the release keystore. Well, I go to the page to get the key, and it says, that I have to port my maps to version 2. I can't do that now. Release is planned now, as said, everything is finished and tested. Is there a way to still get a version 1 key!? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: How can users enable compatibility mode?
Yes, a Nexus 7. Am Donnerstag, 18. April 2013 08:37:31 UTC+2 schrieb Piren: You are using a tablet right? :) Big screen support only shows the Zoom icon on large screen devices (tablets, maybe phablets as well, never seen it on a Note though) On Wednesday, April 17, 2013 11:11:39 PM UTC+3, user123 wrote: Well, then that's my question. Why the device is not showing them. I put both min and target SDK to 8. I also don't have manifest element for explicit support of large screens. So this option should appear. But I don't see it. Just the action bar, with 3 dots for my custom menu and that's it :( Am Mittwoch, 17. April 2013 09:09:20 UTC+2 schrieb Piren: You don't enable it on the device.. the device does it for you. If the app wasn't designed for a tablet and meets the conditions (like having the targetSdk below a set level and/or having not declared it is destined for big screens) then the device will show the proper compatibility options like the Zoom button or the 3 dots. On Monday, April 15, 2013 10:37:42 PM UTC+3, user123 wrote: I read here http://developer.android.com/guide/practices/screen-compat-mode.htmlthat under certain conditions, (optinal) compatibility mode is available to the users. But I can't find it on the device, I looked in the menu of the app, in app's settings, display settings, etc. Nothing with compatibility mode. Where is it / should it be? -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Compatibility mode issues on 4.x
Thanks, Mark. I should have done a better research. So this leads to a quite stupid situation. I did the work to optimize layout for xhdpi devices, like the Galaxy Nexus, and it looks quite well. If I set the compatibility mode to 320dp, this willl be lost on all these devices. Samsung Galaxy s3/4, HTC One, etc, have screen sizes which will make my app go in compatibility mode! For me this is a bug, specially because the larger the screen, the more sense it makes to have the option available to use compatibility mode. And precisely then it's not possible. Am Mittwoch, 17. April 2013 22:36:47 UTC+2 schrieb Mark Murphy (a Commons Guy): If you read the documentation: http://developer.android.com/guide/topics/manifest/supports-screens-element.html#largestWidth it says: Note: Currently, screen compatibility mode emulates only handset screens with a 320dp width, so screen compatibility mode is not applied if your value for android:largestWidthLimitDp is larger than 320. On Wed, Apr 17, 2013 at 4:26 PM, user123 ivans...@gmail.com javascript: wrote: Ok, the issue is confirmed. I created a brand new project with a blank activity, and ran it on a tablet. The only modification I did was in the manifest, as follows: uses-sdk android:minSdkVersion=8 android:targetSdkVersion=8 / supports-screens android:largestWidthLimitDp=320 / Then the app goes in compatibility mode - Hello world! is zoomed. Fine. But if I change to 321 dp - It doesn't go into compatibility mode. I tested with a Nexus 7 tablet, Nexus 7 emulator, and 10.1 inches tablet emulator. Is this a bug? Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.7 Available! -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Compatibility mode issues on 4.x
Well, my layout is density independent. I misused the density folders as approximation for screen size, and it worked well on smartphones The issue is that this app was never intended for tablets - but, great, in Android it's possible to exclude small screens, but not large ones. Nobody in the company was interested in using this app on large screens, so I never got the order or time to do this work. Now this app is available but the development is suspended - I'm also not working there anymore. The app looks perfect in all smartphones. But on tabled-sized screens it has mayor errors, because of some calculations I had to do programmatically, which seem to have a problem when the screen is large, and some places where I forgot nine patch buttons and things like that. There where also a lot of backgrounds with bitmap-shadow, where the content had to be adjusted with pixel-accuracy to look correct. So, yeah, if I could, I would just put this application off for tablets, because that's was what I was told to, actually. But it's not possible. But I thought Okay, I can resort to compatibility mode. But great to see, now, that this also doesn't work. So now I have to spend a weekend working for free, because my company doesn't targets the tablet market but Android thinks it's important? Am Donnerstag, 18. April 2013 13:58:26 UTC+2 schrieb Mark Murphy: On Thu, Apr 18, 2013 at 3:53 AM, user123 ivans...@gmail.com javascript: wrote: I did the work to optimize layout for xhdpi devices Then you did it wrong. Layouts should be density-independent. The layout of an Xperia Z (xxhdpi) should be the same as a Galaxy Nexus (xhdpi), which should be the same as a Nexus S (hdpi), etc., as they are all the same basic screen size, within fractions of an inch. Screen size != screen density. In fact, there is no correlation between the two. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.7 Available! -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Compatibility mode issues on 4.x
Well, my layout is density independent. I misused the density folders as approximation for screen size, and it worked well on smartphones The issue is that this app was never intended for tablets - but, great, in Android it's possible to exclude small screens, but not large ones. Nobody in the company was interested in using this app on large screens, so I never got the order or time to do this work. Now this app is available but the development is suspended - I'm also not working there anymore. The app looks perfect in all smartphones. But on tabled-sized screens it has mayor errors, because of some calculations I had to do programmatically, which seem to have a problem when the screen is large, and some places where I forgot nine patch buttons and things like that. There where also a lot of backgrounds with bitmap-shadow, where the content had to be adjusted very accuratedly to look correct. So, yeah, if I could, I would just put this application off for tablets, because that's was what I was told to, actually. But it's not possible. But I thought Okay, I can resort to compatibility mode. But great to see, now, that this also doesn't work. So now I have to spend a weekend working for free, because my company doesn't targets the tablet market but Android thinks it's important? Am Donnerstag, 18. April 2013 13:58:26 UTC+2 schrieb Mark Murphy: On Thu, Apr 18, 2013 at 3:53 AM, user123 ivans...@gmail.com javascript: wrote: I did the work to optimize layout for xhdpi devices Then you did it wrong. Layouts should be density-independent. The layout of an Xperia Z (xxhdpi) should be the same as a Galaxy Nexus (xhdpi), which should be the same as a Nexus S (hdpi), etc., as they are all the same basic screen size, within fractions of an inch. Screen size != screen density. In fact, there is no correlation between the two. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.7 Available! -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Compatibility mode issues on 4.x
The point is - if somebody sees my app on a tablet, like now, they will think what the ...? They'll think I have no idea. But if people sees it in compatibility mode (or even better, they can't download it), they say, okay, the app was not intended for tablets! - That's a huge difference. Am Donnerstag, 18. April 2013 22:30:18 UTC+2 schrieb user123: Well, my layout is density independent. I misused the density folders as approximation for screen size, and it worked well on smartphones The issue is that this app was never intended for tablets - but, great, in Android it's possible to exclude small screens, but not large ones. Nobody in the company was interested in using this app on large screens, so I never got the order or time to do this work. Now this app is available but the development is suspended - I'm also not working there anymore. The app looks perfect in all smartphones. But on tabled-sized screens it has mayor errors, because of some calculations I had to do programmatically, which seem to have a problem when the screen is large, and some places where I forgot nine patch buttons and things like that. There where also a lot of backgrounds with bitmap-shadow, where the content had to be adjusted very accuratedly to look correct. So, yeah, if I could, I would just put this application off for tablets, because that's was what I was told to, actually. But it's not possible. But I thought Okay, I can resort to compatibility mode. But great to see, now, that this also doesn't work. So now I have to spend a weekend working for free, because my company doesn't targets the tablet market but Android thinks it's important? Am Donnerstag, 18. April 2013 13:58:26 UTC+2 schrieb Mark Murphy: On Thu, Apr 18, 2013 at 3:53 AM, user123 ivans...@gmail.com wrote: I did the work to optimize layout for xhdpi devices Then you did it wrong. Layouts should be density-independent. The layout of an Xperia Z (xxhdpi) should be the same as a Galaxy Nexus (xhdpi), which should be the same as a Nexus S (hdpi), etc., as they are all the same basic screen size, within fractions of an inch. Screen size != screen density. In fact, there is no correlation between the two. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.7 Available! -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: How can users enable compatibility mode?
Well, then that's my question. Why the device is not showing them. I put both min and target SDK to 8. I also don't have manifest element for explicit support of large screens. So this option should appear. But I don't see it. Just the action bar, with 3 dots for my custom menu and that's it :( Am Mittwoch, 17. April 2013 09:09:20 UTC+2 schrieb Piren: You don't enable it on the device.. the device does it for you. If the app wasn't designed for a tablet and meets the conditions (like having the targetSdk below a set level and/or having not declared it is destined for big screens) then the device will show the proper compatibility options like the Zoom button or the 3 dots. On Monday, April 15, 2013 10:37:42 PM UTC+3, user123 wrote: I read here http://developer.android.com/guide/practices/screen-compat-mode.htmlthat under certain conditions, (optinal) compatibility mode is available to the users. But I can't find it on the device, I looked in the menu of the app, in app's settings, display settings, etc. Nothing with compatibility mode. Where is it / should it be? -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
Ok, the issue is confirmed. I created a brand new project with a blank activity, and ran it on a tablet. The only modification I did was in the manifest, as follows: uses-sdk android:minSdkVersion=8 android:targetSdkVersion=8 / supports-screens android:largestWidthLimitDp=320 / Then the app goes in compatibility mode - Hello world! is zoomed. Fine. But if I change to *321 dp *- It doesn't go into compatibility mode. Is this a bug? Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
Ok, the issue is confirmed. I created a brand new project with a blank activity, and ran it on a tablet. The only modification I did was in the manifest, as follows: uses-sdk android:minSdkVersion=8 android:targetSdkVersion=8 / supports-screens android:largestWidthLimitDp=320 / Then the app goes in compatibility mode - Hello world! is zoomed. Fine. But if I change to *321 dp *- It doesn't go into compatibility mode. I tested with a Nexus 7 tablet, Nexus 7 emulator, and 10.1 inches tablet emulator. Is this a bug? Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] How can users enable compatibility mode?
I read here http://developer.android.com/guide/practices/screen-compat-mode.htmlthat under certain conditions, (optinal) compatibility mode is available to the users. But I can't find it on the device, I looked in the menu of the app, in app's settings, display settings, etc. Nothing with compatibility mode. Where is it / should it be? -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
So, now I tested again with the emulator. I started the shipped AVD for the nexus 7. 800 x 1280 tvdpi. According to my dip calculatioon, the smallest side (800), with this density (~216ppi), is ~479 dp Now, according to the documentation: supports-screens android:compatibleWidthLimitDp=320 / This indicates that the maximum smallest screen width for which your application is designed is 320dp. This way, any devices with their smallest side being larger than this value will offer screen compatibility mode as a user-optional feature. And supports-screens android:largestWidthLimitDp=320 / This works the same as android:compatibleWidthLimitDphttp://developer.android.com/guide/topics/manifest/supports-screens-element.html#compatibleWidth except it force-enables screen compatibility mode and does not allow users to disable it. So to *force compatibility mode*, I put in my manifest: uses-sdk android:minSdkVersion=7 android:targetSdkVersion=15/ *supports-screens android:largestWidthLimitDp=400 /* Or: uses-sdk android:minSdkVersion=7/ *supports-screens android:largestWidthLimitDp=400 /* Doesn't work - the Nexus 7 emulator is not in compatibility mode. *Why*? Am Sonntag, 24. März 2013 01:48:16 UTC+1 schrieb user123: Nobody uses compatibility mode? I thought it would be a superbasic question, there are a lot of tablets and there are a lot of apps which don't optimize for that size... Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Text dissapears when view is rotated in getChildStaticTransformation (4.x / maybe also honeycomb)
This is strange, since the text disappears completly as soon as the view is rotated just a little bit. And it only happens on 4.x. I'm already using the camera. But I solved it rendering the textviews to bitmaps, for now. Am Montag, 18. März 2013 23:07:53 UTC+1 schrieb Romain Guy (Google): If you're doing a 3D rotation the problem might be due to a combination of angle of rotation and size of the rotated elements. The element you are rotating might end up being clipped by the camera and disappear. To work around this we expose an API in Camera that lets you specify the distance of the camera to the scene. On Mon, Mar 18, 2013 at 3:02 PM, user123 ivans...@gmail.com javascript: wrote: Now I also noticed that it happens only with android:hardwareAccelerated=false. When true, the text is displayed. But I need to set it to false, because otherwise the views don't rotate correctly... (it's a well known issue e.g. with this http://code.google.com/p/android-coverflow/coverflow implementation). Am Montag, 18. März 2013 12:52:28 UTC+1 schrieb user123: It seems to be 4.2 only. I tested in the emulator 4.0, 4.1 and 4.2 and happened only on 4.2. As mentioned, concerning devices, I have only 4.2, where it happens. I'm using Google maps api (the emulators have to be configured to use this instead of plain 4.x), but I think it's not relevant for this. Am Montag, 18. März 2013 12:20:12 UTC+1 schrieb user123: I just have 2 devices, Galaxy Nexus and Nexus 7, both with 4.2. Can't test on more. If nobody else has feedback on this, I would submit the bug anyways (?). Am Montag, 18. März 2013 06:56:50 UTC+1 schrieb Romain Guy (Google): Does it happen on all 4.x versions? (4.0, 4.1 and 4.2?) If so, please file a bug at b.android.com. On Sun, Mar 17, 2013 at 4:38 PM, user123 ivans...@gmail.com wrote: I'm rotating a custom view, which contains a textview, using getChildStaticTransformation: @Override protected boolean getChildStaticTransformation(**View child, Transformation t) { t.clear(); t.setTransformationType(**Transformation.TYPE_MATRIX); camera.save(); final Matrix imageMatrix = t.getMatrix(); float transX = (textView.getWidth() / 2.0f); float transY = (textView.getHeight() / 2.0f); camera.rotateY(rot); camera.getMatrix(imageMatrix); imageMatrix.preTranslate(-**transX, -transY); imageMatrix.postTranslate(**transX, transY); camera.restore(); //... } This works very well on all 2.x devices I have tested, but in 4.x devices, on angle != 0, the text dissapears. Rotation works well, but the text dissapears. It appears again if rotation is 0. What can I do to solve this? Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@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=enhttp://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+**unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Romain Guy Android framework engineer roma...@android.com -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Romain Guy Android framework engineer roma...@android.com javascript: -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers
[android-developers] Re: Compatibility mode issues on 4.x
It seems that this combination works: uses-sdk android:minSdkVersion=7 android:targetSdkVersion=8/ *supports-screens android:largestWidthLimitDp=400 /* Confirmation follows. Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
Ah, no, I became happy too quickly. I was launching an old version of the app (where I used 320 dip). So the problem is still the same. No compatibility mode. Am Montag, 15. April 2013 23:05:37 UTC+2 schrieb user123: It seems that this combination works: uses-sdk android:minSdkVersion=7 android:targetSdkVersion=8/ *supports-screens android:largestWidthLimitDp=400 /* Confirmation follows. Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
The problem is the Nexus 7. The smallest side is 4.72 inches. But I can put max. 320 dp in the manifest for it to go in compatibility mode. With 321 it doesn't work anymore. Am Montag, 15. April 2013 23:30:37 UTC+2 schrieb bob: Let's just think about this for a minute. 320 dp is 2 inches. Here are the specs for your Galaxy Nexus: 1280×720 px *(316 ppi) So, we are interested in the smallest side. That is 720. 720/316 = 2.27848101266 inches So, it is rightly going into compatibility mode on your Galaxy phone since 2.27848101266 inches is longer than 2 inches. Let's see what 2.27848101266 is in dp: 2.27848101266 * 160 = 364.556962026 dp So, if you set it to 365dp or higher, then your phone should not go into compatibility mode. Thanks. On Tuesday, March 19, 2013 11:46:49 AM UTC-5, user123 wrote: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
Now I also tested with a tablet emulator with 10.1 diagonal. The smallest side should be something around 7 inches. And I still get compatibility mode only until max. 320 dp, like in the Nexus 7. Am Montag, 15. April 2013 23:53:26 UTC+2 schrieb user123: The problem is the Nexus 7. The smallest side is 4.72 inches. But I can put max. 320 dp in the manifest for it to go in compatibility mode. With 321 it doesn't work anymore. Am Montag, 15. April 2013 23:30:37 UTC+2 schrieb bob: Let's just think about this for a minute. 320 dp is 2 inches. Here are the specs for your Galaxy Nexus: 1280×720 px *(316 ppi) So, we are interested in the smallest side. That is 720. 720/316 = 2.27848101266 inches So, it is rightly going into compatibility mode on your Galaxy phone since 2.27848101266 inches is longer than 2 inches. Let's see what 2.27848101266 is in dp: 2.27848101266 * 160 = 364.556962026 dp So, if you set it to 365dp or higher, then your phone should not go into compatibility mode. Thanks. On Tuesday, March 19, 2013 11:46:49 AM UTC-5, user123 wrote: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Strange memory consumption switching between activities
I'm running an app in a 4.2 Nexus 7 device. It has 64 mb app memory. I have 2 activities - and a button to toggle between them. When I start activity A, then B, then A, B, A, B, etc. After a while I get an out of memory error. I investigated this problem with a heap dump and the memory analysis tools. I found that, basically, the problem is, that the main view - instances of these activities, are kept in memory- and instantiated again and again every time I start this activity! Concretly: - In activity A I have a coverflow instance, which is basically a Gallery with some 3d effect. - In activity B I have a gridview If I switch let's say 8 times between A and B, the heap analysis shows me that 8 instances of coverflow, and 8 instances of gridview are in memory! Each occupying ~1.4 mb BTW: I'm using images, but these are managed by universal image loader library, which I have used frequently now and doesn't seem to cause problems / leaks. Also, the bitmap - occupied space shown by the memory analysis is small. The big issue are these instances of coverflow and gridview. I'm not retaining these instances in static variables or anything. I don't know why they are kept in memory. I also added System.gc calls and method to clear the memory cache of the image loader library - but this doesn't help. Since the main problem seem to be that these instances are retained (although I don't know how/where), I understand that gc doesn't help. So, after the users switch screens a while, they get an out of memory. How can I solve this? I went through many option of the memory analysis but didn't find anything that tells me, where/how/when these instances are retained. 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Strange memory consumption switching between activities
Ah. Right. I'm an idiot :) I have a side navigation menu and there user can keep tapping item A, item B, item A, item B, etc. And everything is kept in the navigation stack. Now I'm calling finish on the current activity after starting a new one. The problem seems to be fixed. Thanks! Am Samstag, 6. April 2013 22:48:01 UTC+2 schrieb RichardC: You need to do is : A - start B - AB - finish B - A - start B - AB - finish B - A What you are doing (if you have explained correctly is): A - start B - B - start A - ABA - start B - ABA - start B - ABAB etc On Saturday, April 6, 2013 5:56:39 PM UTC+1, user123 wrote: I'm running an app in a 4.2 Nexus 7 device. It has 64 mb app memory. I have 2 activities - and a button to toggle between them. When I start activity A, then B, then A, B, A, B, etc. After a while I get an out of memory error. I investigated this problem with a heap dump and the memory analysis tools. I found that, basically, the problem is, that the main view - instances of these activities, are kept in memory- and instantiated again and again every time I start this activity! Concretly: - In activity A I have a coverflow instance, which is basically a Gallery with some 3d effect. - In activity B I have a gridview If I switch let's say 8 times between A and B, the heap analysis shows me that 8 instances of coverflow, and 8 instances of gridview are in memory! Each occupying ~1.4 mb BTW: I'm using images, but these are managed by universal image loader library, which I have used frequently now and doesn't seem to cause problems / leaks. Also, the bitmap - occupied space shown by the memory analysis is small. The big issue are these instances of coverflow and gridview. I'm not retaining these instances in static variables or anything. I don't know why they are kept in memory. I also added System.gc calls and method to clear the memory cache of the image loader library - but this doesn't help. Since the main problem seem to be that these instances are retained (although I don't know how/where), I understand that gc doesn't help. So, after the users switch screens a while, they get an out of memory. How can I solve this? I went through many option of the memory analysis but didn't find anything that tells me, where/how/when these instances are retained. 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Grid view with proportional images?
yeah, as already mentioned it was a copy paste issue. Am Dienstag, 2. April 2013 21:55:36 UTC+2 schrieb bob: Here’s the rule for integer vs. floating-point division: / is integer division only if both the numerator and denominator are integer types. If either is a floating-point number, floating-point division is done instead. *Hillegass, Aaron (2011-11-22). Objective-C Programming: The Big Nerd Ranch Guide (p. 45). Pearson Education (US). Kindle Edition. * On Monday, March 18, 2013 12:51:58 PM UTC-5, user123 wrote: Yes, sorry, it was in the original code, and I removed it before pasting here (thought it could be unnecessary) the line is double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight() * 1d); Am Montag, 18. März 2013 18:08:56 UTC+1 schrieb bob: Shouldn't you convert the getWidth() and getHeight() to *double*s before your division? Thanks. On Monday, March 18, 2013 9:41:26 AM UTC-5, user123 wrote: I 4 - colums grid where the items are an image on top and bellow a textview. The image fills all the available width - no padding or anything. My images will all have exactly the same size. Now I want that the height of the view adjusts to the width - to keep the images proportional. AFAIK this is not possible with Android's scaling types. So I put this code after I load the bitmap (it's feched from the web): imageView.post(new Runnable() { @Override public void run() { double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight()); int width = imageView.getWidth(); int newH = (int)(width * factor); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH); imageView.setLayoutParams(params); //convertViewFinal.invalidate(); //doesn't help //convertViewFinal.requestLayout(); //doesn't help } }); It works for most of the images, but on some, it doesn't show any image (the imageview looks like GONE), and in some cases this also breaks the grid layout. Why is it? I know that the bitmaps are fine, because, in my testing application, I loop through the same bitmaps many times - they appear after x items in the grid again, and they are fine. And each time I load the grid, different items have the problem. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Compatibility mode issues on 4.x
Nobody uses compatibility mode? I thought it would be a superbasic question, there are a lot of tablets and there are a lot of apps which don't optimize for that size... Am Dienstag, 19. März 2013 17:46:49 UTC+1 schrieb user123: I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Grid view with proportional images?
Thanks for your help, but I think you have no idea - how else would you organize the views inside cells? You maybe have worked with list view? What do you use there for the rows? And I prefer not having to scale the bitmaps. Am Montag, 18. März 2013 22:17:18 UTC+1 schrieb bob: I've never used GridView, but that sounds fishy using a LinearLayout for each cell. Why not just use wrap_content, wrap_content for the ImageViews and scale all bitmaps using this: public static Bitmap *createScaledBitmap* (Bitmap src, int dstWidth, int dstHeight, boolean filter) Added in API level 1 Creates a new bitmap, scaled from an existing bitmap, when possible. If the specified width and height are the same as the current width and height of the source btimap, the source bitmap is returned and now new bitmap is created. Parameters src The source bitmap. dstWidth The new bitmap's desired width. dstHeight The new bitmap's desired height. filter true if the source should be filtered. Returns The new scaled bitmap or the source bitmap if no scaling is required. On Monday, March 18, 2013 3:55:37 PM UTC-5, user123 wrote: They are in a linear layout, each cell has a (linear) layout... This also would cause a class cast exception. Am Montag, 18. März 2013 20:15:17 UTC+1 schrieb bob: I think this only works if your images are in a LinearLayout.: *LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH);* Maybe change LinearLayout to *GridView*? On Monday, March 18, 2013 12:51:58 PM UTC-5, user123 wrote: Yes, sorry, it was in the original code, and I removed it before pasting here (thought it could be unnecessary) the line is double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight() * 1d); Am Montag, 18. März 2013 18:08:56 UTC+1 schrieb bob: Shouldn't you convert the getWidth() and getHeight() to *double*s before your division? Thanks. On Monday, March 18, 2013 9:41:26 AM UTC-5, user123 wrote: I 4 - colums grid where the items are an image on top and bellow a textview. The image fills all the available width - no padding or anything. My images will all have exactly the same size. Now I want that the height of the view adjusts to the width - to keep the images proportional. AFAIK this is not possible with Android's scaling types. So I put this code after I load the bitmap (it's feched from the web): imageView.post(new Runnable() { @Override public void run() { double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight()); int width = imageView.getWidth(); int newH = (int)(width * factor); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH); imageView.setLayoutParams(params); //convertViewFinal.invalidate(); //doesn't help //convertViewFinal.requestLayout(); //doesn't help } }); It works for most of the images, but on some, it doesn't show any image (the imageview looks like GONE), and in some cases this also breaks the grid layout. Why is it? I know that the bitmaps are fine, because, in my testing application, I loop through the same bitmaps many times - they appear after x items in the grid again, and they are fine. And each time I load the grid, different items have the problem. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Compatibility mode issues on 4.x
I'm trying to force compatibility mode on tablets, for a certain app, because I don't work on it anymore - and currently it looks really really messed up on tablets. According to the documentation: http://developer.android.com/guide/practices/screen-compat-mode.html There are many different options to set up in the manifest, to make it possible, to the user, to enable compatibility mode. This is not exactly what I want, but anyways, maybe worth to mention, these options didn't work. I couldn't find anything on the device to switch to compatibility mode. I used a Nexus 7 with 4.2. Now there's the part which I need - and I also can't get it to work. To force compatibility mode, it I have to use this element: supports-screens android:largestWidthLimitDp=320 / When I let the value 320 there, my Galaxy Nexus smartphone goes in compatibility mode. That is unwanted. The Nexus 7 also does, this is good. So I have to use bigger dp - But starting at 321, for some reason I don't understand, the Nexus 7 doesn't go anymore in compatibility mode. Is this normal? According to what I read the dp of the shortest side of the Nexus 7 is more than 500, why then it stops on 321? I would let it on 320, but I have optimized layouts for this screen size and don't want these to go in compatibility mode. Thanks. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Text dissapears when view is rotated in getChildStaticTransformation (4.x / maybe also honeycomb)
I just have 2 devices, Galaxy Nexus and Nexus 7, both with 4.2. Can't test on more. If nobody else has feedback on this, I would submit the bug anyways (?). Am Montag, 18. März 2013 06:56:50 UTC+1 schrieb Romain Guy (Google): Does it happen on all 4.x versions? (4.0, 4.1 and 4.2?) If so, please file a bug at b.android.com. On Sun, Mar 17, 2013 at 4:38 PM, user123 ivans...@gmail.com javascript: wrote: I'm rotating a custom view, which contains a textview, using getChildStaticTransformation: @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); t.setTransformationType(Transformation.TYPE_MATRIX); camera.save(); final Matrix imageMatrix = t.getMatrix(); float transX = (textView.getWidth() / 2.0f); float transY = (textView.getHeight() / 2.0f); camera.rotateY(rot); camera.getMatrix(imageMatrix); imageMatrix.preTranslate(-transX, -transY); imageMatrix.postTranslate(transX, transY); camera.restore(); //... } This works very well on all 2.x devices I have tested, but in 4.x devices, on angle != 0, the text dissapears. Rotation works well, but the text dissapears. It appears again if rotation is 0. What can I do to solve this? Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Romain Guy Android framework engineer roma...@android.com javascript: -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Text dissapears when view is rotated in getChildStaticTransformation (4.x / maybe also honeycomb)
It seems to be 4.2 only. I tested in the emulator 4.0, 4.1 and 4.2 and happened only on 4.2. As mentioned, concerning devices, I have only 4.2, where it happens. I'm using Google maps api (the emulators have to be configured to use this instead of plain 4.x), but I think it's not relevant for this. Am Montag, 18. März 2013 12:20:12 UTC+1 schrieb user123: I just have 2 devices, Galaxy Nexus and Nexus 7, both with 4.2. Can't test on more. If nobody else has feedback on this, I would submit the bug anyways (?). Am Montag, 18. März 2013 06:56:50 UTC+1 schrieb Romain Guy (Google): Does it happen on all 4.x versions? (4.0, 4.1 and 4.2?) If so, please file a bug at b.android.com. On Sun, Mar 17, 2013 at 4:38 PM, user123 ivans...@gmail.com wrote: I'm rotating a custom view, which contains a textview, using getChildStaticTransformation: @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); t.setTransformationType(Transformation.TYPE_MATRIX); camera.save(); final Matrix imageMatrix = t.getMatrix(); float transX = (textView.getWidth() / 2.0f); float transY = (textView.getHeight() / 2.0f); camera.rotateY(rot); camera.getMatrix(imageMatrix); imageMatrix.preTranslate(-transX, -transY); imageMatrix.postTranslate(transX, transY); camera.restore(); //... } This works very well on all 2.x devices I have tested, but in 4.x devices, on angle != 0, the text dissapears. Rotation works well, but the text dissapears. It appears again if rotation is 0. What can I do to solve this? Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Romain Guy Android framework engineer roma...@android.com -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Slow tiles dissapearing animation
I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Slow tiles dissapearing animation
I did a tiny optimization, I prefill a list with the children, such that I just do childrenList.get(index); instead of int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); But, as expected, this didn't have a noticeable improvement. Am Montag, 18. März 2013 14:53:18 UTC+1 schrieb user123: I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Slow tiles dissapearing animation
Ah, the number of cells is not high, I'm testing between 8x8 and 12x12 Am Montag, 18. März 2013 14:53:18 UTC+1 schrieb user123: I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Grid view with proportional images?
I 4 - colums grid where the items are an image on top and bellow a textview. The image fills all the available width - no padding or anything. My images will all have exactly the same size. Now I want that the height of the view adjusts to the width - to keep the images proportional. AFAIK this is not possible with Android's scaling types. So I put this code after I load the bitmap (it's feched from the web): imageView.post(new Runnable() { @Override public void run() { double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight()); int width = imageView.getWidth(); int newH = (int)(width * factor); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH); imageView.setLayoutParams(params); //convertViewFinal.invalidate(); //doesn't help //convertViewFinal.requestLayout(); //doesn't help } }); It works for most of the images, but on some, it doesn't show any image (the imageview looks like GONE), and in some cases this also breaks the grid layout. Why is it? I know that the bitmaps are fine, because, in my testing application, I loop through the same bitmaps many times - they appear after x items in the grid again, and they are fine. And each time I load the grid, different items have the problem. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Grid view with proportional images?
Yes, sorry, it was in the original code, and I removed it before pasting here (thought it could be unnecessary) the line is double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight() * 1d); Am Montag, 18. März 2013 18:08:56 UTC+1 schrieb bob: Shouldn't you convert the getWidth() and getHeight() to *double*s before your division? Thanks. On Monday, March 18, 2013 9:41:26 AM UTC-5, user123 wrote: I 4 - colums grid where the items are an image on top and bellow a textview. The image fills all the available width - no padding or anything. My images will all have exactly the same size. Now I want that the height of the view adjusts to the width - to keep the images proportional. AFAIK this is not possible with Android's scaling types. So I put this code after I load the bitmap (it's feched from the web): imageView.post(new Runnable() { @Override public void run() { double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight()); int width = imageView.getWidth(); int newH = (int)(width * factor); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH); imageView.setLayoutParams(params); //convertViewFinal.invalidate(); //doesn't help //convertViewFinal.requestLayout(); //doesn't help } }); It works for most of the images, but on some, it doesn't show any image (the imageview looks like GONE), and in some cases this also breaks the grid layout. Why is it? I know that the bitmaps are fine, because, in my testing application, I loop through the same bitmaps many times - they appear after x items in the grid again, and they are fine. And each time I load the grid, different items have the problem. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Slow tiles dissapearing animation
For a simple animation like this? That's a total overkill... Am Montag, 18. März 2013 17:12:52 UTC+1 schrieb bob: Maybe use OpenGL? On Monday, March 18, 2013 8:53:18 AM UTC-5, user123 wrote: I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Slow tiles dissapearing animation
Well, the simple is my opinion, of course, fading out 50-100 cells quickly, doesn't feels like OpenGL to me. Besides I have a sliding menu on the side (like Facebook app), and my experiences with OpenGL, is that it will not slide with the rest of the content. Which makes sense according to some docs I read that the OpenGL view is a hole in the screen. Am Montag, 18. März 2013 18:55:28 UTC+1 schrieb user123: For a simple animation like this? That's a total overkill... Am Montag, 18. März 2013 17:12:52 UTC+1 schrieb bob: Maybe use OpenGL? On Monday, March 18, 2013 8:53:18 AM UTC-5, user123 wrote: I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Grid view with proportional images?
They are in a linear layout, each cell has a (linear) layout... This also would cause a class cast exception. Am Montag, 18. März 2013 20:15:17 UTC+1 schrieb bob: I think this only works if your images are in a LinearLayout.: *LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH);* Maybe change LinearLayout to *GridView*? On Monday, March 18, 2013 12:51:58 PM UTC-5, user123 wrote: Yes, sorry, it was in the original code, and I removed it before pasting here (thought it could be unnecessary) the line is double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight() * 1d); Am Montag, 18. März 2013 18:08:56 UTC+1 schrieb bob: Shouldn't you convert the getWidth() and getHeight() to *double*s before your division? Thanks. On Monday, March 18, 2013 9:41:26 AM UTC-5, user123 wrote: I 4 - colums grid where the items are an image on top and bellow a textview. The image fills all the available width - no padding or anything. My images will all have exactly the same size. Now I want that the height of the view adjusts to the width - to keep the images proportional. AFAIK this is not possible with Android's scaling types. So I put this code after I load the bitmap (it's feched from the web): imageView.post(new Runnable() { @Override public void run() { double factor = loadedBitmap.getWidth() / (loadedBitmap.getHeight()); int width = imageView.getWidth(); int newH = (int)(width * factor); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, newH); imageView.setLayoutParams(params); //convertViewFinal.invalidate(); //doesn't help //convertViewFinal.requestLayout(); //doesn't help } }); It works for most of the images, but on some, it doesn't show any image (the imageview looks like GONE), and in some cases this also breaks the grid layout. Why is it? I know that the bitmaps are fine, because, in my testing application, I loop through the same bitmaps many times - they appear after x items in the grid again, and they are fine. And each time I load the grid, different items have the problem. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Slow tiles dissapearing animation
Doesn't help... I think it's even worser now. Am Montag, 18. März 2013 20:28:21 UTC+1 schrieb bob: Maybe try this? In your Android manifest file, add the following attribute to the application tag to enable hardware acceleration for your entire application: application *android:hardwareAccelerated=true* ... *http://developer.android.com/guide/topics/graphics/hardware-accel.html* On Monday, March 18, 2013 1:03:31 PM UTC-5, user123 wrote: Well, the simple is my opinion, of course, fading out 50-100 cells quickly, doesn't feels like OpenGL to me. Besides I have a sliding menu on the side (like Facebook app), and my experiences with OpenGL, is that it will not slide with the rest of the content. Which makes sense according to some docs I read that the OpenGL view is a hole in the screen. Am Montag, 18. März 2013 18:55:28 UTC+1 schrieb user123: For a simple animation like this? That's a total overkill... Am Montag, 18. März 2013 17:12:52 UTC+1 schrieb bob: Maybe use OpenGL? On Monday, March 18, 2013 8:53:18 AM UTC-5, user123 wrote: I'm trying to make one of these animations where an image fades in with tiles. (Note: I need this to work from Api 8) To do that, I created a black grid and put it on top of the image and using a handler, make each cell dissapear. It works but the animation takes a bit more than 1 second, even when I post to the handler without any delay. This looks laggy and strange. The effect has to be very quick. I tried many things - using programmatically generated linearlayout with rows instead of grid, using fade out animation, using no animation at all, toggling visibility with View.GONE, or View.INVISIBLE, or just setting the background color to 0x. Nothing helps, I can't make the animation quicker. I tested in 2.3 smartphone, in 4.2 smartphone and 4.2 tablet, all look the same. Well, in the 4.2 devices, the animation sometimes doesn't show at all - like it was executed already. But when it's visible, it's slow. Any advice on this? Or do I have to use a completly different approach? Is there a library to do this kind of effects, maybe? Here is my relevant code: ListInteger done = new ArrayListInteger(); private Handler handler = new Handler(); private Runnable fadeInRunnable = new Runnable() { @Override public void run() { if (!done.isEmpty()) { //int index = (int)(Math.random() * done.size()); int index = 0; int itemIndex = done.get(index); int rowIndex = (int)Math.floor(itemIndex / ROWS); ViewGroup row = (ViewGroup)imageMask.getChildAt(rowIndex); View child = row.getChildAt(itemIndex - (rowIndex * ROWS)); // child.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_short)); //child.startAnimation(anim); child.setBackgroundColor(0x); //child.setVisibility(View.INVISIBLE); done.remove(index); handler.post(this); //handler.postDelayed(this, 1); } } }; Thanks in advance, Ivan -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Text dissapears when view is rotated in getChildStaticTransformation (4.x / maybe also honeycomb)
Now I also noticed that it happens only with android:hardwareAccelerated=false. When true, the text is displayed. But I need to set it to false, because otherwise the views don't rotate correctly... (it's a well known issue e.g. with this http://code.google.com/p/android-coverflow/coverflow implementation). Am Montag, 18. März 2013 12:52:28 UTC+1 schrieb user123: It seems to be 4.2 only. I tested in the emulator 4.0, 4.1 and 4.2 and happened only on 4.2. As mentioned, concerning devices, I have only 4.2, where it happens. I'm using Google maps api (the emulators have to be configured to use this instead of plain 4.x), but I think it's not relevant for this. Am Montag, 18. März 2013 12:20:12 UTC+1 schrieb user123: I just have 2 devices, Galaxy Nexus and Nexus 7, both with 4.2. Can't test on more. If nobody else has feedback on this, I would submit the bug anyways (?). Am Montag, 18. März 2013 06:56:50 UTC+1 schrieb Romain Guy (Google): Does it happen on all 4.x versions? (4.0, 4.1 and 4.2?) If so, please file a bug at b.android.com. On Sun, Mar 17, 2013 at 4:38 PM, user123 ivans...@gmail.com wrote: I'm rotating a custom view, which contains a textview, using getChildStaticTransformation: @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); t.setTransformationType(Transformation.TYPE_MATRIX); camera.save(); final Matrix imageMatrix = t.getMatrix(); float transX = (textView.getWidth() / 2.0f); float transY = (textView.getHeight() / 2.0f); camera.rotateY(rot); camera.getMatrix(imageMatrix); imageMatrix.preTranslate(-transX, -transY); imageMatrix.postTranslate(transX, transY); camera.restore(); //... } This works very well on all 2.x devices I have tested, but in 4.x devices, on angle != 0, the text dissapears. Rotation works well, but the text dissapears. It appears again if rotation is 0. What can I do to solve this? Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Romain Guy Android framework engineer roma...@android.com -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Text dissapears when view is rotated in getChildStaticTransformation (4.x / maybe also honeycomb)
I'm rotating a custom view, which contains a textview, using getChildStaticTransformation: @Override protected boolean getChildStaticTransformation(View child, Transformation t) { t.clear(); t.setTransformationType(Transformation.TYPE_MATRIX); camera.save(); final Matrix imageMatrix = t.getMatrix(); float transX = (textView.getWidth() / 2.0f); float transY = (textView.getHeight() / 2.0f); camera.rotateY(rot); camera.getMatrix(imageMatrix); imageMatrix.preTranslate(-transX, -transY); imageMatrix.postTranslate(transX, transY); camera.restore(); //... } This works very well on all 2.x devices I have tested, but in 4.x devices, on angle != 0, the text dissapears. Rotation works well, but the text dissapears. It appears again if rotation is 0. What can I do to solve this? Thanks in advance! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Can this variable become null?
Statics? The state of the singleton is instance, not class based. Besides of the singleton itself. But it's private. And you access it using public static void getInstance() { if (instance == null) { intance = new Whatever(); } return instance; } If the system destroys the app, it will be initialized in the next access - safe. And the possibility that someone can do bad things with the singletons, like storing views or other things which can lead to memory leaks is not a reason to stop using them. You can do this with any class. Am Freitag, 15. März 2013 00:45:49 UTC+1 schrieb Kristopher Micinski: I guess the bigger problem that in Android static data members cannot be statically checked to be alive. By this I mean: you should try to get as much static checking as possible, and if you're using statics you don't have any ability to properly check this. Moreover, in Android it's a fact of life that your app will die and restart. You can really only use statics for caching type purposes, but working with them in a safe way quickly becomes extremely complicated. Instead of doing this, you can typically replace singletons with some Android specific utility (a Service or ContentProvider, say..) that allows you to implement the singleton type pattern. This really *is* a pretty frequent problem when people get UI elements stuck into static variables and then users rotate the screen :-) Kris On Thu, Mar 14, 2013 at 7:11 PM, Mark Murphy mmu...@commonsware.comjavascript: wrote: On Thu, Mar 14, 2013 at 7:00 PM, user123 ivans...@gmail.comjavascript: wrote: What is the problem with singleton? http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons And, since they don't seem to emphasize the point quite enough for my taste: static data members are, by definition, memory leaks. How *bad* of a memory leak they are depends on what they are and how they are used. Like many programming techniques, singletons can be used as a scalpel or a sledgehammer. The general advice against singletons is because most people reading that advice are inexperienced and are likely to do damage with either a scalpel or a sledgehammer. On the whole, AFAICT, tolerance for singletons decreases with increased production Java development experience, based on the conversations that I have had on the topic over the past few years. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.6 Available! -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] How to set Google Analytics (v2) API key programmatically?
I can't find how to do this. There's this documentation: https://developers.google.com/analytics/devguides/collection/android/v2/advanced - it shows this method: gaInstance.getTracker(trackingId) I tried this: GoogleAnalytics gaInstance = GoogleAnalytics.getInstance(context); Tracker gaTracker = gaInstance.getTracker(apiKeyGA); gaInstance.setDefaultTracker(gaTracker); But it doesn't work, the api key is not used. I need it, because my app has to track to different accounts, depending of a certain server configuration. The server will send me the api key where to track to. Please don't tell me that it's not possible... 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Can this variable become null?
What is the problem with singleton? It works very well. I use it to hold global state, for example, translations. They are fetched at the start of the app, and updated each screen launch (if necessary). This holds the translations in memory and I can get them from any activity using simple methods. I can control everything there - reinitialize if destroyed, etc. There's also a very popular image loading library, which works very well for me, which also uses the singleton pattern. It initializes in application's onCreate() and after that everytime you load an image, just use ~1 line of code. Which better approach would you suggest for these use cases, and why? Am Dienstag, 26. Februar 2013 06:19:24 UTC+1 schrieb William Ferguson: You should access it with a getInstance method which will initialize it if it is null. You should initialize the variable in the class initialization and declare it 'final'. There are times when you cannot do this, in which case probably Singleton is the wrong choice. For the rest of the times, Singleton probably is the wrong choice. :-) +1 to 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] How to remove black topbar on activity animation?
Ok, thanks. I ended just doing the animation very fast... such that the user doesn't have time to think about it ;) Am Dienstag, 14. August 2012 08:12:17 UTC+2 schrieb Dianne Hackborn: I assume you mean the part of your window that is normally behind the status bar? If so, there is no simple way to do this. Aside from just making your app fullscreen so there is no status bar (and thus your content draws all the way to the top), you'd need to do an approach like playing games where you make your window translucent, set it to not have a background, and make sure that tap part of your window is transparent when it is drawn. Note that in 3.1 the platform know does some tricks to prevent that top part of the window from being drawn when it determines it is obscured by the status bar prior to any transformation applied by an animation etc. On Sat, Aug 11, 2012 at 2:20 PM, user123 ivans...@gmail.com javascript: wrote: I defined a scale animation from 0 to 1 for entering activity: overridePendingTransition(R.anim.scale, 0); In application tag in Manifest: android:theme=@android:style/Theme.NoTitleBar But I get a black topbar on the entering activity, while it scales... looks very ugly since the activity doesn't have this topbar. How do I hide 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-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hac...@android.com javascript: Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Best way to apply complex actions to view during pressed state?
This worked perfectly! I don't need ACTION_MOVE anymore. I knew there was a simple solution for this. Thanks. Am Dienstag, 26. Februar 2013 00:04:28 UTC+1 schrieb bob: You need to process ACTION_CANCEL. If a user presses the button and slides his finger off the button before lifting it up, that's a cancel. On Monday, February 25, 2013 4:51:18 PM UTC-6, user123 wrote: I want to apply certain transforms to a view and it's children during pressed state, e.g. a color filter. As far my current knowledge, I can't do this using StateListDrawable or XML configuration. The concrete situation: A GridView where the cells have a background drawable, an ImageView, and text. When the user is pressing a cell, I want to change the background, to apply a PorterDuff color filter to the image, and change the color of the text. The images are downloaded from the web. My first try was to generate bitmaps for both states (pressed and not pressed) at runtime, inflating the layout twice and using `getDrawingCache()`. Then create a StateListDrawable and set both states. Wasn't a complete fail but I started getting some strange issues, and I think this will also not allow we to recycle views (Edit: But I might continue that path if the following approach is wrong). So I tried a completly different thing - set touch listener on each cell, which works like this: view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int x = (int)event.getX(); int y = (int)event.getY(); int space = 10; switch(event.getAction() MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: moved = false; pressedX = x; pressedY = y; //apply color filter //do other changes return true; case MotionEvent.ACTION_UP: if (!moved) { //clear color filter //undo other changes return true; } case MotionEvent.ACTION_MOVE: if (Math.abs(x - pressedX) space || Math.abs(y - pressedY) space) { moved = true; //clear color filter //undo other changes return true; } } return false; } }); But the ACTION_MOVE part here is basically a hack, and also doesn't work well. First, it makes that the pressed state finishes while the user is moving inside the cell. Not tragic, but doesn't have to be necessarily this way. But it has the bug, that when the user moves out of the cell very quickly - or starts at the edges and moves out - such that there's no ACTION_UP in the cell and sometimes ACTION_MOVE is not even called, or the value is less than space, the cell keeps pressed! So, in order to solve that, I thought about adding an OnTouchListener to the parent view of the grid / the activity, and check on ACTION_MOVE if it's outside of the grid and then loop through the cells and reset pressed state... but you see this is ugly and also bad performance. And I don't know if I'm missing an easy solution and running unnecessarily in complications. Does anybody have an advice for this? Thanks in advance. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Best way to apply complex actions to view during pressed state?
Thanks. This sounds interesting but I'll go for the other solution, because it's very easy to implement and it worked. But I might use this one for other things. Am Dienstag, 26. Februar 2013 09:31:01 UTC+1 schrieb skink: On 25 Lut, 23:51, user123 ivanschu...@gmail.com wrote: I want to apply certain transforms to a view and it's children during pressed state, e.g. a color filter. As far my current knowledge, I can't do this using StateListDrawable or XML configuration. The concrete situation: A GridView where the cells have a background drawable, an ImageView, and text. When the user is pressing a cell, I want to change the background, to apply a PorterDuff color filter to the image, and change the color of the text. The images are downloaded from the web. Does anybody have an advice for this? Thanks in advance. step #1: override getView in your adapter step #2: before returning your grid item set its Drawable to: GridDrawable d = new GridDrawable(); v.setBackgroundDrawable(d); return v; step#3: create GridDrawable class: class GridDrawable extends Drawable { @Override protected boolean onStateChange(int[] state) { String st = StateSet.dump(state); Log.d(TAG, onStateChange + st); // set the color fileter if state is either: // {android.R.attr.state_selected} or // {android.R.attr.state_pressed} return false; } @Override public boolean isStateful() { return true; } @Override public void draw(Canvas canvas) { } @Override public void setAlpha(int alpha) { } @Override public void setColorFilter(ColorFilter cf) { } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } } pskink -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Can this variable become null?
I have an instance variable in a singleton class which I'm using in all the app. It's basically a global configuration parameter. I initialize it in the first (launcher) screen of the app. The app will not continue without this initialization (where it's sure that the variable is not null). And I'll not use the variable before of this. After the variable is initialized, the value is never set again, only read. And I'm wondering, if there's any case where I can get a null pointer? Because e.g. the system kills the app while it's in the background, and tries to restart it in the last screen - since the variable is only initialized in the launcher screen, it will not be initialized? Does this case exist? I made a few tests - I stopped the app from settings. Then the app started from launcher screen, so everything fine. I also threw a RuntimeException from a random screen. After it, the system started the app from launcher screen, so again, fine. But I don't know if background app killed by the system behaves differently. Can't simulate that. And maybe there are other cases which I'm missing. So, is there any situation where my variable can become null? Or is this setup safe? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: Can this variable become null?
No, no, the question is not about the singleton itself. It's about an instance variable of the singleton. Am Montag, 25. Februar 2013 16:36:39 UTC+1 schrieb bob: You are not using the singleton pattern properly. You should access it with a getInstance method which will initialize it if it is null. On Monday, February 25, 2013 3:52:30 AM UTC-6, user123 wrote: I have an instance variable in a singleton class which I'm using in all the app. It's basically a global configuration parameter. I initialize it in the first (launcher) screen of the app. The app will not continue without this initialization (where it's sure that the variable is not null). And I'll not use the variable before of this. After the variable is initialized, the value is never set again, only read. And I'm wondering, if there's any case where I can get a null pointer? Because e.g. the system kills the app while it's in the background, and tries to restart it in the last screen - since the variable is only initialized in the launcher screen, it will not be initialized? Does this case exist? I made a few tests - I stopped the app from settings. Then the app started from launcher screen, so everything fine. I also threw a RuntimeException from a random screen. After it, the system started the app from launcher screen, so again, fine. But I don't know if background app killed by the system behaves differently. Can't simulate that. And maybe there are other cases which I'm missing. So, is there any situation where my variable can become null? Or is this setup safe? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Can this variable become null?
Ok, thanks. I couldn't reproduce this case, so I wasn't sure. I'll handle it in other way then. Am Montag, 25. Februar 2013 17:34:43 UTC+1 schrieb TreKing: On Mon, Feb 25, 2013 at 3:52 AM, user123 ivans...@gmail.com javascript: wrote: And I'm wondering, if there's any case where I can get a null pointer? Because e.g. the system kills the app while it's in the background, and tries to restart it in the last screen - since the variable is only initialized in the launcher screen, it will not be initialized? Does this case exist? To answer your question, yes that exact case does exist, so you don't want to initialize your data in the launcher screen. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Can this variable become null?
Ok, thanks, this was exactly what I needed to know. The case where the system kills the app while being in the background and not in first screen. Am Montag, 25. Februar 2013 18:21:27 UTC+1 schrieb Streets Of Boston: In addition to Treking's answer; Never rely on the order in which (you think that) activities are started to initialize or modify static/global data. E.g. User goes through your app, starting from the homescreen, going from Activity A then to Activity B then to C. This could be order in which the activities are created: A -- B -- C Now your user presses the Home key and does something else for a while and the OS decides to kill your app, because it is in the background. When the user comes back to your app, this may happen (it depends how your activities were launched): First Activity C is shown, since that was the last one that the user saw. When the user now hits the back-button a few times, this could be the order in which the activities are created: C -- B -- A. Total different order. If your global/static data relies on the activitie's creation order, you may run into subtle or not-so-subtle problems. On Monday, February 25, 2013 11:34:43 AM UTC-5, TreKing wrote: On Mon, Feb 25, 2013 at 3:52 AM, user123 ivans...@gmail.com wrote: And I'm wondering, if there's any case where I can get a null pointer? Because e.g. the system kills the app while it's in the background, and tries to restart it in the last screen - since the variable is only initialized in the launcher screen, it will not be initialized? Does this case exist? To answer your question, yes that exact case does exist, so you don't want to initialize your data in the launcher screen. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Best way to apply complex actions to view during pressed state?
I want to apply certain transforms to a view and it's children during pressed state, e.g. a color filter. As far my current knowledge, I can't do this using StateListDrawable or XML configuration. The concrete situation: A GridView where the cells have a background drawable, an ImageView, and text. When the user is pressing a cell, I want to change the background, to apply a PorterDuff color filter to the image, and change the color of the text. The images are downloaded from the web. My first try was to generate bitmaps for both states (pressed and not pressed) at runtime, inflating the layout twice and using `getDrawingCache()`. Then create a StateListDrawable and set both states. Wasn't a complete fail but I started getting some strange issues, and I think this will also not allow we to recycle views (Edit: But I might continue that path if the following approach is wrong). So I tried a completly different thing - set touch listener on each cell, which works like this: view.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int x = (int)event.getX(); int y = (int)event.getY(); int space = 10; switch(event.getAction() MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: moved = false; pressedX = x; pressedY = y; //apply color filter //do other changes return true; case MotionEvent.ACTION_UP: if (!moved) { //clear color filter //undo other changes return true; } case MotionEvent.ACTION_MOVE: if (Math.abs(x - pressedX) space || Math.abs(y - pressedY) space) { moved = true; //clear color filter //undo other changes return true; } } return false; } }); But the ACTION_MOVE part here is basically a hack, and also doesn't work well. First, it makes that the pressed state finishes while the user is moving inside the cell. Not tragic, but doesn't have to be necessarily this way. But it has the bug, that when the user moves out of the cell very quickly - or starts at the edges and moves out - such that there's no ACTION_UP in the cell and sometimes ACTION_MOVE is not even called, or the value is less than space, the cell keeps pressed! So, in order to solve that, I thought about adding an OnTouchListener to the parent view of the grid / the activity, and check on ACTION_MOVE if it's outside of the grid and then loop through the cells and reset pressed state... but you see this is ugly and also bad performance. And I don't know if I'm missing an easy solution and running unnecessarily in complications. Does anybody have an advice for this? Thanks in advance. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] getDrawingCache() and transparency?
I convert a view in a bitmap using drawing cache. But when I use a transparent background in the view, the bitmap doesn't show. The code: //View v = inflate etc. v.setDrawingCacheEnabled(true); v.setLayoutParams(new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); v.measure( MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); v.buildDrawingCache(true); if (v.getDrawingCache() != null) { bitmap = Bitmap.createBitmap(v.getDrawingCache()); } This works as long as I use an opaque color as background of my view, like: android:background=#ff But as soon I put some transparency, like android:background=#88ff or don't use background at all, the bitmap doesn't show anything (there are some other views with content inside, which should show). I also tried adding this line: v.setDrawingCacheBackgroundColor(0x); with some different colors. No effect. I need a transparent background for this view. What do I do to get it also in the bitmap? 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Light green background when saving image to file
I'm implementing an image cache for PNGs, downloaded from the web. Works well so far, besides that on images with a transparent background, get a light-green background, when they are read from the cache (external storage). Tested on 3 devices, the problem was in 2 of them, a Samsung Galaxy and HTC desire. The third one, a Galaxy Nexus, has not this problem. The relevant parts of code: Save to file: FileOutputStream outputStream = new FileOutputStream(fileUri); image.compress(Bitmap.CompressFormat.PNG, 100, outputStream); outputStream.flush(); outputStream.close(); Read file: File file = new File(fullCacheDir.toString(), fileName); Download from web: DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.execute(request); InputStream is = response.getEntity().getContent(); TypedValue typedValue = new TypedValue(); typedValue.density = TypedValue.DENSITY_DEFAULT; Drawable drawable = Drawable.createFromResourceStream(null, typedValue, is, src); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Light green background when saving image to file
P.S: The original is not transparent, as I wrote. It's white. On Tuesday, October 2, 2012 9:31:24 AM UTC+2, user123 wrote: I'm implementing an image cache for PNGs, downloaded from the web. Works well so far, besides that on images with a transparent background, get a light-green background, when they are read from the cache (external storage). Tested on 3 devices, the problem was in 2 of them, a Samsung Galaxy and HTC desire. The third one, a Galaxy Nexus, has not this problem. The relevant parts of code: Save to file: FileOutputStream outputStream = new FileOutputStream(fileUri); image.compress(Bitmap.CompressFormat.PNG, 100, outputStream); outputStream.flush(); outputStream.close(); Read file: File file = new File(fullCacheDir.toString(), fileName); Download from web: DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.execute(request); InputStream is = response.getEntity().getContent(); TypedValue typedValue = new TypedValue(); typedValue.density = TypedValue.DENSITY_DEFAULT; Drawable drawable = Drawable.createFromResourceStream(null, typedValue, is, src); -- 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: Reliable way to detect application launch from home / desktop?
Google Analytics! I want to track when the user opens the app (taps on the icon in apps or home screen in order to launch it). On Wednesday, August 22, 2012 6:09:09 PM UTC+2, MagouyaWare wrote: Why are you wanting to detect this? Perhaps there is a better way to accomplish what you are trying to do Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Wed, Aug 22, 2012 at 9:14 AM, Carlos A. M. dos Santos unix...@gmail.com javascript: wrote: On Wed, Aug 22, 2012 at 10:58 AM, user123 ivans...@gmail.comjavascript: wrote: This will not be executed always. Android lets apps running in the background, although user closed it. When you launch the app it will not necessarily be created. I suggest you to get satisfied with what you have. The world is cruel. --8-- @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); boolean fromLauncher = savedInstanceState == null Intent.ACTION_MAIN.equals(intent.getAction()) intent.getCategories().contains(Intent.CATEGORY_LAUNCHER); -- The flames are all long gone, but the pain lingers on -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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] Reliable way to detect application launch from home / desktop?
I want to detect each time the user opens the app, by tap on home / desktop icon. There seem not to be a straight forward way to do it. Found a few workarounds but nothing seems to be really reliable. Things like, extend application object and use method onCreate(), but this is not what I need because it's not called always when the user taps on the app's icon (can be just brought from the background), and also the application may be destroyed and recreated while running. Then Application.onCreate() will also be called. There war also some approaches involving BroadcastReceiver and checking intent flags but everything seems to be also not quite reliable? I need this because I want to track with Google Analytics, when the user opens the app. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Reliable way to detect application launch from home / desktop?
Open: launch clicking on icon, either in applications or on home. Doesn't this cover your case? On Wednesday, August 22, 2012 2:04:59 PM UTC+2, RichardC wrote: I think you need to re-consider your definition of open. I use long-press-home 90% of the time to launch applications I use on a regular basis. On Wednesday, August 22, 2012 12:33:29 PM UTC+1, user123 wrote: I want to detect each time the user opens the app, by tap on home / desktop icon. There seem not to be a straight forward way to do it. Found a few workarounds but nothing seems to be really reliable. Things like, extend application object and use method onCreate(), but this is not what I need because it's not called always when the user taps on the app's icon (can be just brought from the background), and also the application may be destroyed and recreated while running. Then Application.onCreate() will also be called. There war also some approaches involving BroadcastReceiver and checking intent flags but everything seems to be also not quite reliable? I need this because I want to track with Google Analytics, when the user opens the app. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Reliable way to detect application launch from home / desktop?
But there doesn't seem to be a solution valid for all cases, then. onResume() will also be called each time I launch the activity. Or it's shown at the foreground, because something which was in front of it was closed. This is not what I want. onCreate() with LAUNCHER category will be called only when the app is indeed created, but this will not be always the case when user opens the app. And in the last case (Application onCreate) there's also the problem that the application will not necessarily be created when the user launches it. On Wednesday, August 22, 2012 2:00:51 PM UTC+2, casantos wrote: On Wed, Aug 22, 2012 at 8:33 AM, user123 ivans...@gmail.com javascript: wrote: I want to detect each time the user opens the app, by tap on home / desktop icon. There seem not to be a straight forward way to do it. Found a few workarounds but nothing seems to be really reliable. The invoking intent will have action android.intent.action.MAIN and category android.intent.category.LAUNCHER. Things like, extend application object and use method onCreate(), but this is not what I need because it's not called always when the user taps on the app's icon (can be just brought from the background), In this case onResume() will be called, but not onCreate. and also the application may be destroyed and recreated while running. Then Application.onCreate() will also be called. You can differentiate this situation by the fact that in the first invocation the Bundle passed to onCreate() is null. When the activity is recreated onCreate receives a copy of the intent given to onSaveInstanceState() before onStop() is called. -- The flames are all long gone, but the pain lingers on -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Reliable way to detect application launch from home / desktop?
I want to detect exactly when the user says, hey, let's open the app, and taps on the app's icon, not anything else. Is this hard to understand? On Wednesday, August 22, 2012 1:33:29 PM UTC+2, user123 wrote: I want to detect each time the user opens the app, by tap on home / desktop icon. There seem not to be a straight forward way to do it. Found a few workarounds but nothing seems to be really reliable. Things like, extend application object and use method onCreate(), but this is not what I need because it's not called always when the user taps on the app's icon (can be just brought from the background), and also the application may be destroyed and recreated while running. Then Application.onCreate() will also be called. There war also some approaches involving BroadcastReceiver and checking intent flags but everything seems to be also not quite reliable? I need this because I want to track with Google Analytics, when the user opens the app. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Reliable way to detect application launch from home / desktop?
This will not be executed always. Android lets apps running in the background, although user closed it. When you launch the app it will not necessarily be created. On Wednesday, August 22, 2012 3:00:40 PM UTC+2, casantos wrote: On Wed, Aug 22, 2012 at 9:23 AM, user123 ivans...@gmail.com javascript: wrote: I want to detect exactly when the user says, hey, let's open the app, and taps on the app's icon, not anything else. Is this hard to understand? @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); boolean fromLauncher = savedInstanceState == null Intent.ACTION_MAIN.equals(intent.getAction()) intent.getCategories().contains(Intent.CATEGORY_LAUNCHER); -- 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] libcore.io.ErrnoException: open failed: EMFILE (Too many open files)
I implemented a file cache to load small images for a long grid view. After scrolling a while, I get a lot of `libcore.io.ErrnoException: open failed: EMFILE (Too many open files)` How do I avoid this? This is the code to read one bitmap: File fullCacheDir = new File(Environment.getExternalStorageDirectory().toString(), cacheDir); File file = new File(fullCacheDir.toString(), fileName); if (!file.exists()) { return null; } Bitmap bm = BitmapFactory.decodeFile(file.toString()); This is to save one bitmap: FileOutputStream outputStream = new FileOutputStream(fileUri); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); outputStream.flush(); outputStream.close(); -- 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] How to avoid multiple bitmap instantiation in list view, when fetching asynchronously?
Hi, I have a big problem with bitmaps and the listview's behaviour of calling getView() on each position multiple times. My list contains only bitmaps and fetches them asynchronously from a remote location. Now, when the listview is displayed, since getView() is called about 4 times for each position, it will instantiate 4 different bitmap instances for the same position (and use only one...), and this causes out of memory error. I already tried out some strategies to solve this, like implementing a list of waiting imageViews, and fetch only for one, and then set the bitmap for all the waiting ones, but this generated new problems and it's also difficult to synchronize. I tried also adding a list-field with already fetched positions of the listview, in order to fetch and set only once, but it seems to generate a different image view each time (I'm recycling convertView, but anyways), since I end with empty positions (although all the bitmaps where fetched, instantiated and set in one of the imageviews). To solve this I used a map-field which maps position to ListImageView, and set the bitmap to all the imageViews which where called for one position. Should work, but it also doesn't. In most positions I get the correct bitmaps, but, for example, in the first position of the list, I get the bitmap from the last visible position (I can see it switches fast, first it shows bitmap from position 0, then 1, then 2, and then 3 -my last visible position-). Any solution? 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
[android-developers] Re: How to avoid multiple bitmap instantiation in list view, when fetching asynchronously?
Another possibility which comes to my mind, but feels like a terrible solution, is to pre-fetch the bitmaps, so, before the list scrolls, I have already next x bitmaps in the cache. This would be implemented in combination with a scrolllistener, where scrolling causes to fetch the next x items and put them in the cache. So when the list calls getView() (no matter how offen), it will always get the same prefetched bitmap instance from the cache). -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to avoid multiple bitmap instantiation in list view, when fetching asynchronously?
You don't understand what I mean. The problem is that in getView() I make a call to fetch the bitmap from remote. And if getView() is calles multiple times for one position, this call will be made multiple times, and the resulting bitmap will be instantiated multiple times. If I recycle the view/use convertView or not doesn't make a difference (for this issue). BTW, I have already a bitmap cache, which solves the problem after having fetched the bitmaps the first time. But my problem is about the first time creating many bitmaps (e.g. first 4 positions visible - bitmaps for item 0, item 1, item 2, item 3 - 16 bitmaps, and I just needed 4). On Monday, August 13, 2012 4:14:30 PM UTC+2, bob wrote: Why not use the convertView parameter to getView? On Monday, August 13, 2012 8:45:15 AM UTC-5, user123 wrote: Hi, I have a big problem with bitmaps and the listview's behaviour of calling getView() on each position multiple times. My list contains only bitmaps and fetches them asynchronously from a remote location. Now, when the listview is displayed, since getView() is called about 4 times for each position, it will instantiate 4 different bitmap instances for the same position (and use only one...), and this causes out of memory error. I already tried out some strategies to solve this, like implementing a list of waiting imageViews, and fetch only for one, and then set the bitmap for all the waiting ones, but this generated new problems and it's also difficult to synchronize. I tried also adding a list-field with already fetched positions of the listview, in order to fetch and set only once, but it seems to generate a different image view each time (I'm recycling convertView, but anyways), since I end with empty positions (although all the bitmaps where fetched, instantiated and set in one of the imageviews). To solve this I used a map-field which maps position to ListImageView, and set the bitmap to all the imageViews which where called for one position. Should work, but it also doesn't. In most positions I get the correct bitmaps, but, for example, in the first position of the list, I get the bitmap from the last visible position (I can see it switches fast, first it shows bitmap from position 0, then 1, then 2, and then 3 -my last visible position-). Any solution? 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
[android-developers] JPG corrupted after save and load from external storage
Hi, I have a jpg with a white background, and after saving and loading it to external storage, it's corrupted. Looks like: https://lh6.googleusercontent.com/-9vcaZSUl50o/UCkrum2278I/AAM/mPPofE7qhrk/s1600/img.jpg The code: Save: try { outStream = new FileOutputStream(fileUri); image.compress(Bitmap.CompressFormat.JPEG, 100, outStream); outStream.flush(); outStream.close(); } catch (Exception e) { Log.e(cache, e.getMessage()); e.printStackTrace(); } Load: Bitmap bm = BitmapFactory.decodeFile(fileUri.toString()); What am I doing wrong? Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] JPG corrupted after save and load from external storage
What do you mean exactly with original? I'm downloading it from the web, the image in the web has jpg extension. Maybe it's important, this is the code I instantiate the downloaded bitmap/drawable (which is later saved to the sd card) with: InputStream is = fetch(urlString); TypedValue typedValue = new TypedValue(); typedValue.density = TypedValue.DENSITY_DEFAULT; Drawable drawable = Drawable.createFromResourceStream(null, typedValue, new FlushedInputStream(is), src); On Monday, August 13, 2012 6:41:31 PM UTC+2, Harri Smått wrote: On Aug 13, 2012, at 7:31 PM, user123 ivans...@gmail.com javascript: wrote: What am I doing wrong? Thanks. This is a long shot but are you sure original image is JPG and not a PNG with alpha channel? Alpha could cause some unexpected behaviour once storing image as JPG. -- H -- 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] JPG corrupted after save and load from external storage
Oh, and the fetch method looks like this: private InputStream fetch(String urlString) throws MalformedURLException, IOException { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.execute(request); return response.getEntity().getContent(); } On Monday, August 13, 2012 7:05:01 PM UTC+2, user123 wrote: What do you mean exactly with original? I'm downloading it from the web, the image in the web has jpg extension. Maybe it's important, this is the code I instantiate the downloaded bitmap/drawable (which is later saved to the sd card) with: InputStream is = fetch(urlString); TypedValue typedValue = new TypedValue(); typedValue.density = TypedValue.DENSITY_DEFAULT; Drawable drawable = Drawable.createFromResourceStream(null, typedValue, new FlushedInputStream(is), src); On Monday, August 13, 2012 6:41:31 PM UTC+2, Harri Smått wrote: On Aug 13, 2012, at 7:31 PM, user123 ivans...@gmail.com wrote: What am I doing wrong? Thanks. This is a long shot but are you sure original image is JPG and not a PNG with alpha channel? Alpha could cause some unexpected behaviour once storing image as JPG. -- H -- 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] How to remove black topbar on activity animation?
I defined a scale animation from 0 to 1 for entering activity: overridePendingTransition(R.anim.scale, 0); In application tag in Manifest: android:theme=@android:style/Theme.NoTitleBar But I get a black topbar on the entering activity, while it scales... looks very ugly since the activity doesn't have this topbar. How do I hide 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
[android-developers] Re: java.lang.IllegalStateException: Fragement no longer exists for key f1: index 3
Well, for now I surrounded pager.setAdapter(adapter); with a try - catch. Happens mostly when the screen is not visible anymore, so it's not critical. But it still would be good to understand it and be able to fix correctly. I was reading the source and as far as I remember, it was related with saving the fragment's state appropiatedly, the active fragment list and the fragment manager... but it's quite dense and there should be better documentation on this... On Sunday, August 5, 2012 5:25:37 PM UTC+2, hostj2me wrote: I am also seeing this issue. java.lang.IllegalStateException: Fragement no longer exists for key f451: index 2 at android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:534) at android.support.v4.app.FragmentStatePagerAdapter.restoreState(FragmentStatePagerAdapter.java:208) at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:374) Have you found a solution? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: java.lang.IllegalStateException: Fragement no longer exists for key f1: index 3
Well, for now I surrounded pager.setAdapter(adapter); with a try - catch. Happens mostly when the screen is not visible anymore, so it's not critical. But it still would be good to understand it and be able to fix correctly. I was reading the source and as far as I remember, it was related with saving the fragment's state appropiatedly, the active fragment list and the fragment manager... but it's quite dense and there should be better documentation on this... On Sunday, August 5, 2012 5:25:37 PM UTC+2, hostj2me wrote: I am also seeing this issue. java.lang.IllegalStateException: Fragement no longer exists for key f451: index 2 at android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:534) at android.support.v4.app.FragmentStatePagerAdapter.restoreState(FragmentStatePagerAdapter.java:208) at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:374) Have you found a solution? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to remove black topbar on activity animation?
If it's of interest for somebody, here is the xml of the animation: scale xmlns:android=http://schemas.android.com/apk/res/android; android:duration=1000 android:fromXScale=0 android:fromYScale=0 android:pivotX=50% android:pivotY=50% android:toXScale=1 android:toYScale=1 android:fillAfter=true / On Saturday, August 11, 2012 11:20:52 PM UTC+2, user123 wrote: I defined a scale animation from 0 to 1 for entering activity: overridePendingTransition(R.anim.scale, 0); In application tag in Manifest: android:theme=@android:style/Theme.NoTitleBar But I get a black topbar on the entering activity, while it scales... looks very ugly since the activity doesn't have this topbar. How do I hide 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
[android-developers] java.lang.IllegalStateException: Fragement no longer exists for key f1: index 3
I want to understand this exception in order to implement a proper fix. Overview: There's a ViewPager and it uses a FragmentStatePagerAdapter to instantiate 2 fragments via getItem and MyFragmentClass.newInstance(...). Adapter's getItem looks like this: @Override public Fragment getItem(int position) { Fragment fragment = null; switch(position) { case 0: fragment = MyFragment2.newInstance(par1); break; case 1: fragment = MyFragment2.newInstance(par2, par3); break; } return fragment; } Problem: When the activity is destroyed, and created again, the adapter is intantiated again, the fragments created again with MyFragmentClass.newInstance(...)... but then on this line: pager.setAdapter(adapter); I get the mentioned exception. I looked in the source where the exception is thrown, it's this: @Override public Fragment getFragment(Bundle bundle, String key) { int index = bundle.getInt(key, -1); if (index == -1) { return null; } if (index = mActive.size()) { throw new IllegalStateException(Fragement no longer exists for key + key + : index + index); } Fragment f = mActive.get(index); if (f == null) { throw new IllegalStateException(Fragement no longer exists for key + key + : index + index); } return f; } So, a bundle is passed there, with some state which references my old fragments, but this doesn't correspond to the current state (mActive), and the exceptio is thrown. I don't understand what's the idea behind this, or which way I'm actually supposed to instantiate the fragments... so I have no idea how to solve. I also tried some trick I got from some other context: pager.setOffscreenPageLimit(1); In order to avoid that the fragments are destroyed when they are off screen (in the case of 2 pages viewpager, although don't know if it works well with state adapter). But don't seems to be related, at least, it doesn't help, still get the same exception. Please help, 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
[android-developers] Re: Android pics inverted when taking with front camera (started via intent)
Sorry, I had this problem mixed with a fix I was trying out for other camera issue, and the description is not quite correct. But still a problem. What happens is this: The pic is displayed mirrored, horizontally, on the camera preview. That's fine. But when I pick up the bytes the camera activity stored in the path I passed via: cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(myimgpath.jng))); and build a bitmap again with them, the bitmap is rotated 90°. I don't see a way to hardcode a fix for this, since with the back camera it doesn't happen, and I don't know if the returned bitmap was taken using front or back camera... any idea? On Tuesday, July 31, 2012 6:23:36 AM UTC+2, Dusk Jockeys Android Apps wrote: When you are taking photos of yourself in the front camera, people naturally expect to see the same as if they look in a mirror, so the preview is flipped horizontally. Writing is reversed etc. When the photo is taken, it then takes the real image, without the flipping, so you dont get reversed writing. So it is the preview that is wrong, not the final image. On Tuesday, July 31, 2012 3:12:47 AM UTC+8, bob wrote: I believe I have seen it flipped horizontally in the camera app on my Ice Cream Sandwich. If I was coding, I would just flip it again horizontally to get it back to normal. Or, I would just ignore it as most people are taking pictures of their faces, which are usually somewhat symmetric. On Monday, July 30, 2012 9:12:47 AM UTC-5, user123 wrote: Uhm... don't remember. Is there a solution for any of the cases? I'll check it again. On Monday, July 30, 2012 3:50:52 PM UTC+2, bob wrote: Rotated 180 degrees or flipped horizontally? The latter seems more probable. On Monday, July 30, 2012 7:59:02 AM UTC-5, user123 wrote: I have the same problem described here: Android Front Facing Camera Taking Inverted Photoshttp://stackoverflow.com/questions/10283467/android-front-facing-camera-taking-inverted-photos What's different in my case is that I'm starting the camera app via intent, not implementing it myself. So probably no way to use CameraInfo or the like. How can I solve this? In order to summarize: When starting camera via intent and take the picture using front camera, the returned bitmap is rotated by 180°. -- 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