[android-developers] Will Android Fast Emulator be supported by future AMD Zen processors?
These days new excavator based cpus for the new AM4 socket and chipset will be released, and at the last part of the year, the new Zen AMD processors are being released. In the requisites for Android Fast Emulator I can read this: https://developer.android.com/studio/index.html#Requirements For accelerated emulator: 64-bit operating system and Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality So are AMD users forgoten in the black hole of desperation? or will be supported by zen? Thanks -- 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. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/02e3c92e-38a8-4baf-982e-690276451bd4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: How to delete a cheat score in google play games Leaderboard?
I dont have a web server, so i can't install that web tools, also i dont know anything about web programming, node.js etc... i'm just android developer. How it is supossed android developers must be capable to do all that stuff to delete a hack score on their leaderboards? i am just astonished El miércoles, 18 de marzo de 2015, 19:47:28 (UTC+1), jtoolsdev escribió: And here's the web tools (I thought it was also in the prior package but its not). https://github.com/playgameservices/management-tools On Wednesday, March 18, 2015 at 11:43:40 AM UTC-7, jtoolsdev wrote: Try here: https://github.com/playgameservices/android-basic-samples On Wednesday, March 18, 2015 at 6:57:45 AM UTC-7, saex wrote: emmm... what? a web app? test scores? I can't find any web app and also who has talked about test scores? i am talking about a cheat score, the game is published for months and the leaderboard too. El martes, 17 de marzo de 2015, 19:53:44 (UTC+1), jtoolsdev escribió: There's a web app that Google provides source for that will allow you to delete the test scores. Just look through the docs for the game services and you'll find it. On Tuesday, March 17, 2015 at 8:04:15 AM UTC-7, saex wrote: I have a fake score in my leaderboard, exists a way to delete it? I only can see how to delete the entire leaderboard, but i just want to delete one score... how can this be achieved? tamper protection it's active but not hidding the fake score. Normal top scores are over 300 points, and the fake score is 1.400.000.050 points or something like that thanks PD: exists a google groups forum for google play services problems? or google play game services problems? i know that exists an official google group for admob but can't find it for google play game services... -- 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/d/optout.
[android-developers] Re: How to delete a cheat score in google play games Leaderboard?
emmm... what? a web app? test scores? I can't find any web app and also who has talked about test scores? i am talking about a cheat score, the game is published for months and the leaderboard too. El martes, 17 de marzo de 2015, 19:53:44 (UTC+1), jtoolsdev escribió: There's a web app that Google provides source for that will allow you to delete the test scores. Just look through the docs for the game services and you'll find it. On Tuesday, March 17, 2015 at 8:04:15 AM UTC-7, saex wrote: I have a fake score in my leaderboard, exists a way to delete it? I only can see how to delete the entire leaderboard, but i just want to delete one score... how can this be achieved? tamper protection it's active but not hidding the fake score. Normal top scores are over 300 points, and the fake score is 1.400.000.050 points or something like that thanks PD: exists a google groups forum for google play services problems? or google play game services problems? i know that exists an official google group for admob but can't find it for google play game services... -- 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/d/optout.
[android-developers] How to delete a cheat score in google play games Leaderboard?
I have a fake score in my leaderboard, exists a way to delete it? I only can see how to delete the entire leaderboard, but i just want to delete one score... how can this be achieved? tamper protection it's active but not hidding the fake score. Normal top scores are over 300 points, and the fake score is 1.400.000.050 points or something like that thanks PD: exists a google groups forum for google play services problems? or google play game services problems? i know that exists an official google group for admob but can't find it for google play game services... -- 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/d/optout.
[android-developers] VideoView in scrollview inside a section with header… overlaps the header when i scroll down
I have an app that has a header in the top portion of the app. Below the header it is a linearlayout that has a scrollview. Inside the scrollview I have a linearlayout with some scrollviews on it. I can scroll the scrollview fine if the videos are not playing, but if the videos are playing, the videos overlaps the header of the app in an incredible android layout bug. Can this be solved? VideoViews stopped (works fine): [image: enter image description here] Scrolling down and videoviews playing (wrong behaviour): [image: enter image description here] android http://stackoverflow.com/questions/tagged/android android-layout http://stackoverflow.com/questions/tagged/android-layout scrollview http://stackoverflow.com/questions/tagged/scrollview videoview http://stackoverflow.com/questions/tagged/videoview android-videoview http://stackoverflow.com/questions/tagged/android-videoview -- 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/d/optout.
[android-developers] MapView (Maps V2) not working
Welcome all The tiles of the map are not being updated, the only way to update them is to block the device (onPause called) and to unblock the device (onResume called). If i do that, the tiles become updated it is very strange i mean that if i move the finger doing zoom or moving the map, the map is frozen, and it only reresh it's state when i block and unblock the device all the permissions are fine and the api key also is fine in the manifest this is my code: public class MainActivity extends Activity { MapView map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout main = new LinearLayout(this); main.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); GoogleMapOptions options = new GoogleMapOptions(); options.mapType(GoogleMap.MAP_TYPE_SATELLITE) .compassEnabled(false) .rotateGesturesEnabled(false) .tiltGesturesEnabled(false); options.camera(new CameraPosition(new LatLng(0, 0), 1, 0, 0)); map = new MapView(this, options); map.onCreate(savedInstanceState); main.addView(map); setContentView(main); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); map.onResume(); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); map.onPause(); } } -- 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/d/optout.
[android-developers] It is legal to delete and upload again an application to google play?
i have an app that in the begining has some errors and a lot of users rate it with 1 star and now it have very bad rate. Now the app has solved the errors but still have a lot of negative votes. and no one is downloading it because of the negative rate. ¿It is legal to delete the app and to upload it again to start with 0 installations and 0 rates? -- 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/d/optout.
[android-developers] How to move a view in the screen with a onscreen Joystick?
Welcome all i need to add a onScreen Joystick to my game. I found some code examples of joysticks but none of them moves a view on the screen, and i dont know how to move a view in the screen with the exact movement and acceleration of the joystick movement. This is one of the examples i found: http://www.youtube.com/watch?v=S7U_B7EDT_Q Source code: http://goo.gl/m0bTse I have no idea of how to move a view (my game spaceship) in the screen with the joystick movement. Thanks a lot -- 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/d/optout.
[android-developers] MediaPlayer makes frame rate jump in my animations when loop
I have a game that shows some animations onscreen and one MediaPlayer playing with infinite loop the background music, and i am seeing frame rate jumps when the song ends and start a loop. Why is this happening? MediaPlayer is not efficient in the loop? Can the frame rate jump be avoided? Thanks My mediaplayer: mPlayer = MediaPlayer.create(GameActivity.this, R.raw.pieceofwood); mPlayer.setLooping(true); mPlayer.start(); My animations: fall = ObjectAnimator.ofFloat(view, y,-height, sh); fall.setDuration(fallTime); fall.setInterpolator(null); fall.start(); -- 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/d/optout.
[android-developers] How to show first Public Leaderboards instead of Circles Leaderboards? (Google Play Game Services)
when you are showing a Google Play Game Services LeaderBoard with this code: startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getApiClient(), 33assad87asd), 1); It's first showed the circles leaderboard. I want to show first the Public leaderboard. Is that possible? -- 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/d/optout.
[android-developers] ObjectAnimator starting with a frame jump on Android 4.4 (nexus 5) but not in 4.1 device
I have a simple activity that shows an animation with ObjectAnimator. The animation is created and started in onCreate method of the activity, it is a very simple animation: cloudAnim = ObjectAnimator.ofFloat(cloud1ImageView, x, sw); cloudAnim.setDuration(35000); cloudAnim.setRepeatCount(ValueAnimator.INFINITE); cloudAnim.setRepeatMode(ValueAnimator.RESTART); cloudAnim.setInterpolator(null); cloudAnim.start(); it simply displays a cloud on the left of the screen and moves from the left to the right. The problem is that in my nexus 5 (android 4.4 lastet version) the cloud is doing a frame jump when the activity starts. This jump is only visible in my nexus 5, because i'm testing the app also in a huawei ascend y300 devide with android 4.1 and the jump is not visible, the movement is very smooth. What is wrong with ObjectAnimator and Android 4.4? 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/d/optout.
Re: [android-developers] ObjectAnimator starting with a frame jump on Android 4.4 (nexus 5) but not in 4.1 device
Hi thanks for your answer, i tryed it, and not working :( El domingo, 13 de julio de 2014 12:34:53 UTC+2, Sérgio Faria escribió: My guess would be that you're starting the animation before the view is ready. You can use an old Animation or try to start the Animator in OnPreDrawListener or in onResume(). 2014-07-13 10:44 GMT+01:00 saex an animation with ObjectAnimator. The animation is created and started in onCreate method of the activity, it is a very simple animation: cloudAnim = ObjectAnimator.ofFloat(cloud1ImageView, x, sw); cloudAnim.setDuration(35000); cloudAnim.setRepeatCount(ValueAnimator.INFINITE); cloudAnim.setRepeatMode(ValueAnimator.RESTART); cloudAnim.setInterpolator(null); cloudAnim.start(); it simply displays a cloud on the left of the screen and moves from the left to the right. The problem is that in my nexus 5 (android 4.4 lastet version) the cloud is doing a frame jump when the activity starts. This jump is only visible in my nexus 5, because i'm testing the app also in a huawei ascend y300 devide with android 4.1 and the jump is not visible, the movement is very smooth. What is wrong with ObjectAnimator and Android 4.4? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to To unsubscribe from this group, send email to For more options, visit this group at --- 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 -- 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/d/optout.
[android-developers] Infinite ObjectAnimator decreasing framerate progressively...¿why?
Hi i'm displaying 20 views at same time in the screen. They are inside a layout, and i'm moving them from top of the screen to the bottom with an ObjectAnimator. Each time one view has reached the bottom, the animation is restarted. The problem is that when 10-15 minutes have passed, the screen starts decreasing the frame rate, with some jumps in the animations. Why? there are allways the same objects, and the same animations... why it is decreasing the framerate progresively? Some of my code: fall = ObjectAnimator.ofFloat(view, y,-height, sh); fall.setDuration(fallTime); fall.setInterpolator(null); fall.setRepeatCount(ValueAnimator.INFINITE); fall.setRepeatMode(ValueAnimator.RESTART); fall.addListener(new AnimatorListener() { @Override public void onAnimationCancel(Animator animation) {} @Override public void onAnimationEnd(Animator animation) { freeBurger(); } @Override public void onAnimationRepeat(Animator animation) {} @Override public void onAnimationStart(Animator animation) {} }); fall.start(); -- 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/d/optout.
[android-developers] MotionEvent.ACTION_CANCEL allways called inmediatly after MotionEvent.ACTION_DOWN
Welcome all I'm developing an augmented reality app that consists in a camera view with some linear layouts on the screen representing the position of a POI in the camera. The LinearLayouts contains some view elements that implements onTouchListener and have the action to open a new activity when ACTION_UP event is called. The problem is that ACTION_UP is never called. When i press on one of the POIs on the camera screen, the element calls ACTION_DOWN and instantly after that, ACTION_CANCEL is being called. I read that ACTION_CANCEL occurs when the parent takes possession of the motion, for example when the user has dragged enough across a list view that it will start scrolling instead of letting you press the buttons inside of it. You can find out more about it at the viewgroup documentation of onInterceptTouchEvent. The problem is that i dont understand what i'm doing wrong. This is my code of the ontouch in the element that it is displayed on the linearlayout representing a POI on the camera AR View: public class Element implements OnTouchListener{... @Override public boolean onTouch(View v, MotionEvent event) { if( event.getAction() == MotionEvent.ACTION_DOWN){ return true; }else if( event.getAction() == MotionEvent.ACTION_UP){ parent.doAction(this.action); return true; }else if(event.getAction() == MotionEvent.ACTION_MOVE){ return true; } else if(event.getAction() == MotionEvent.ACTION_CANCEL){ return true; } return true; } 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/d/optout.
[android-developers] Problems with ContentProvider for sharing assets image
Im using the solution of this website: http://www.nowherenearithaca.com/2012/03/too-easy-using-contentprovider-to-send.htmlto share images from assets folder, but it is not working. The share panel is being opened, but when i select gmail, google+ or some other social sharing network, the image is not being shared. The method public AssetFileDescriptor openAssetFile(Uri uri, String mode)is not being called when i try to share an image, and the image is not being shared. Logcat tells this: No content provider found for permission check: content:/com.appname/img319030.jpg I created a class called AssetsContentProvider on my com.appname.utilpackage and i added this line to my manifest: provider android:name=com.appname.util.AssetsContentProvider android:authorities=com.appname/ The class that is trying to use ACTION_SEND to share the image is located on the package com.appname.actions, and it simply does this: Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType(image/jpg); Uri theUri = Uri.parse(content:/com.appname/img319030.jpg); shareIntent.putExtra(Intent.EXTRA_STREAM,theUri); SectionManager.getCurrentActivity().startActivity(Intent.createChooser(shareIntent, )); The image is called img319030.jpg and it is located in assets folder. This is my AssetsContentProvider class: public class AssetsContentProvider extends ContentProvider{ @Override public AssetFileDescriptor openAssetFile(Uri uri, String mode) throws FileNotFoundException { AssetManager am = getContext().getAssets(); String file_name = uri.getLastPathSegment(); if(file_name == null) throw new FileNotFoundException(); AssetFileDescriptor afd = null; try { afd = am.openFd(file_name); } catch (IOException e) { e.printStackTrace(); } return afd;//super.openAssetFile(uri, mode); } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { return 0; } @Override public String getType(Uri uri) { return null; } @Override public Uri insert(Uri uri, ContentValues values) { return null; } @Override public boolean onCreate() { return false; } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { return null; } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { return 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] WebView can not login into a http website with login. Phone navigator can do it
I need to show a webview that let the user enter this website: http://m.orange.es/area_clientes/ If i try to enter to that website and login with my user with the phone navigator, it works fine, and the navigator ask me to accept a certificate. If i try to enter that website and login with a webview in my android App, the webview can't do the login with my user and my password, the accept certificate pop up does not appear, and i'm getting redirected into a error website. How can this be solved? I checked a lot of questions on stackoverflow related with this isseue, but none of them worked: WebView with SSL Client Certificate on Android 4 ICShttp://stackoverflow.com/questions/10683643/webview-with-ssl-client-certificate-on-android-4-ics Does the Web View on Android support SSL?http://stackoverflow.com/questions/5977977/does-the-web-view-on-android-support-ssl Android WebView SSL 'Security Warning'http://stackoverflow.com/questions/3630445/android-webview-ssl-security-warning http://damianflannery.wordpress.com/2010/09/28/android-webview-with-https-loadurl-shows-blankempty-page/ and a lot more links... -- -- 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: Widget onClick is not working
no one can help? El lunes, 25 de febrero de 2013 23:37:27 UTC+1, saex escribió: Hi all I want that when the user press on the widget, the widget stops itself, and when the user press again, the widget put ON his functions i'm using the solution of this post to achieve onClick on my widget: Clickable widgets in androidhttp://stackoverflow.com/questions/2748590/clickable-widgets-in-android The solution works fine in android 2.2 phone and android 4.1 phone but doesn't works on Nexus One with android 2.3.6. I click on the widget but nothing happens... This is my full widget class: public class mWidgetProvider extends AppWidgetProvider{ public static String ACTION_WIDGET_CLICK = ActionWidgetClick; public static final String ACTION_AUTO_UPDATE = AUTO_UPDATE; DecimalFormatSymbols symbols; DecimalFormat tempDecimalFormat; int pMaxFreq=-1; String cCurrentFreq=null; int freq = 0; float usage =-1; BufferedReader freqBufferedReader; PowerManager pm; RemoteViews remoteViews; ComponentName thisWidget; WidgetAlarm widgetAlarm; ActivityManager manager; @Override public void onDisabled(Context context) { super.onDisabled(context); context.stopService(new Intent(context, UpdateService.class)); //stop alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.stopAlarm(); System.out.println(X onDISABLED); } @Override public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); System.out.println(X onDELETED); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); context.startService(new Intent(context, UpdateService.class)); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, mWidgetProvider.class ); //preparamos el evento para cuando el usuario presiona en el widget, ese evento será recibido en onReceive() Intent active = new Intent(context, mWidgetProvider.class); active.setAction(ACTION_WIDGET_CLICK); PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); remoteViews.setOnClickPendingIntent(R.id.fondo, actionPendingIntent); AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); // start alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.startAlarm(); System.out.println(X onUPDATE); } @Override public void onReceive(Context context, Intent intent){ if (intent.getAction().equals(ACTION_WIDGET_CLICK)){ switchWidget(context); }else if(intent.getAction().equals(ACTION_AUTO_UPDATE)){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator('.'); tempDecimalFormat = new DecimalFormat(#.#, symbols); pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, mWidgetProvider.class ); if (pm.isScreenOn()){ /* here i do some work to update the textviews of the widget */ AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); System.out.println(X UPDATING WIDGET); } }else{ super.onReceive(context, intent); } System.out.println(X onRECEIVE: +intent.getAction()); } @Override public void onEnabled(Context context) { super.onEnabled(context); System.out.println(X onENABLED); } public void switchWidget(Context context){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator
[android-developers] Widget onClick is not working
I want that when the user press on the widget, the widget stops itself, and when the user press again, the widget put ON his functions i'm using the solution of this post to achieve onClick on my widget: http://stackoverflow.com/questions/2748590/clickable-widgets-in-android The solution works fine in android 2.2 phone and android 4.1 phone but doesn't works on Nexus One with android 2.3.6. I click on the widget but nothing happens... This is my full widget class: public class mWidgetProvider extends AppWidgetProvider{ public static String ACTION_WIDGET_CLICK = ActionWidgetClick; public static final String ACTION_AUTO_UPDATE = AUTO_UPDATE; DecimalFormatSymbols symbols; DecimalFormat tempDecimalFormat; int pMaxFreq=-1; String cCurrentFreq=null; int freq = 0; float usage =-1; BufferedReader freqBufferedReader; PowerManager pm; RemoteViews remoteViews; ComponentName thisWidget; WidgetAlarm widgetAlarm; ActivityManager manager; @Override public void onDisabled(Context context) { super.onDisabled(context); context.stopService(new Intent(context, UpdateService.class)); //stop alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.stopAlarm(); System.out.println(X onDISABLED); } @Override public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); System.out.println(X onDELETED); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); context.startService(new Intent(context, UpdateService.class)); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, CPUWidgetProvider.class ); //preparamos el evento para cuando el usuario presiona en el widget, ese evento será recibido en onReceive() Intent active = new Intent(context, CPUWidgetProvider.class); active.setAction(ACTION_WIDGET_CLICK); PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); remoteViews.setOnClickPendingIntent(R.id.fondo, actionPendingIntent); AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); // start alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.startAlarm(); System.out.println(X onUPDATE); } @Override public void onReceive(Context context, Intent intent){ if (intent.getAction().equals(ACTION_WIDGET_CLICK)){ switchWidget(context); }else if(intent.getAction().equals(ACTION_AUTO_UPDATE)){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator('.'); tempDecimalFormat = new DecimalFormat(#.#, symbols); pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, CPUWidgetProvider.class ); if (pm.isScreenOn()){ /* here i do some work to update the textviews of the widget */ AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); System.out.println(X UPDATING WIDGET); } }else{ super.onReceive(context, intent); } System.out.println(X onRECEIVE: +intent.getAction()); } @Override public void onEnabled(Context context) { super.onEnabled(context); System.out.println(X onENABLED); } public void switchWidget(Context context){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator('.'); tempDecimalFormat = new DecimalFormat(#.#, symbols); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new
[android-developers] Widget onClick is not working
Hi all I want that when the user press on the widget, the widget stops itself, and when the user press again, the widget put ON his functions i'm using the solution of this post to achieve onClick on my widget: Clickable widgets in androidhttp://stackoverflow.com/questions/2748590/clickable-widgets-in-android The solution works fine in android 2.2 phone and android 4.1 phone but doesn't works on Nexus One with android 2.3.6. I click on the widget but nothing happens... This is my full widget class: public class mWidgetProvider extends AppWidgetProvider{ public static String ACTION_WIDGET_CLICK = ActionWidgetClick; public static final String ACTION_AUTO_UPDATE = AUTO_UPDATE; DecimalFormatSymbols symbols; DecimalFormat tempDecimalFormat; int pMaxFreq=-1; String cCurrentFreq=null; int freq = 0; float usage =-1; BufferedReader freqBufferedReader; PowerManager pm; RemoteViews remoteViews; ComponentName thisWidget; WidgetAlarm widgetAlarm; ActivityManager manager; @Override public void onDisabled(Context context) { super.onDisabled(context); context.stopService(new Intent(context, UpdateService.class)); //stop alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.stopAlarm(); System.out.println(X onDISABLED); } @Override public void onDeleted(Context context, int[] appWidgetIds) { super.onDeleted(context, appWidgetIds); System.out.println(X onDELETED); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); context.startService(new Intent(context, UpdateService.class)); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, mWidgetProvider.class ); //preparamos el evento para cuando el usuario presiona en el widget, ese evento será recibido en onReceive() Intent active = new Intent(context, mWidgetProvider.class); active.setAction(ACTION_WIDGET_CLICK); PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); remoteViews.setOnClickPendingIntent(R.id.fondo, actionPendingIntent); AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); // start alarm widgetAlarm = new WidgetAlarm(context.getApplicationContext()); widgetAlarm.startAlarm(); System.out.println(X onUPDATE); } @Override public void onReceive(Context context, Intent intent){ if (intent.getAction().equals(ACTION_WIDGET_CLICK)){ switchWidget(context); }else if(intent.getAction().equals(ACTION_AUTO_UPDATE)){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator('.'); tempDecimalFormat = new DecimalFormat(#.#, symbols); pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout); thisWidget = new ComponentName(context, mWidgetProvider.class ); if (pm.isScreenOn()){ /* here i do some work to update the textviews of the widget */ AppWidgetManager.getInstance(context).updateAppWidget( thisWidget, remoteViews ); System.out.println(X UPDATING WIDGET); } }else{ super.onReceive(context, intent); } System.out.println(X onRECEIVE: +intent.getAction()); } @Override public void onEnabled(Context context) { super.onEnabled(context); System.out.println(X onENABLED); } public void switchWidget(Context context){ symbols = new DecimalFormatSymbols(Locale.GERMAN); symbols.setDecimalSeparator('.'); tempDecimalFormat = new DecimalFormat(#.#, symbols); remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
[android-developers] Re: Problems with Text To Speech
Your solution didn't works... the same problem El martes, 12 de febrero de 2013 17:55:31 UTC+1, skink escribió: saex wrote: Please, try to make a better explained answer or to test your answer before writting it. btw i hate giving a fish i prefer giving a fish rod, i believe it's better way of learning for the other side 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] How to prompt the user only to download one language? (Text To Speech)
Hi I'm trying to do a text to speech test application, seeing this tutorial: http://android-developers.blogspot.com.es/2009/09/introduction-to-text-to-speech-in.html I tryed doing what the tutorial says, and i'm setting the language only to spanish: mTts = new TextToSpeech(this, this); mTts.setLanguage(new Locale(spa)); The problem is that when the app starts, the app prompts me to a screen asking me download four languages, GERMAN, SPANISH, FRENCH, ITALIAN. If i only download spanish language and then i press back key, the app works, but EACH TIME i start the app, it shows me the same screen to download the other three languages, and only stop appearing if i download the foru languages. My objective is to prompt the user to download ONLY spanish, and to show the languages download dialog only one time, not allways. I'm testing it on a Nexus S phone with 4.1 This is the full code: public class MainActivity extends Activity implements OnInitListener { private static final int MY_DATA_CHECK_CODE = 0; EditText editText; Button button; private TextToSpeech mTts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id.editText); button = (Button) findViewById(R.id.button); editText.setText(Estoy probando, probando y probando, porque hay que probar.); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, MY_DATA_CHECK_CODE); mTts = new TextToSpeech(this, this); mTts.isLanguageAvailable(new Locale(spa)); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mTts.speak(editText.getText().toString(), TextToSpeech.QUEUE_FLUSH, null); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == MY_DATA_CHECK_CODE) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { // success, create the TTS instance mTts = new TextToSpeech(this, this); mTts.setLanguage(new Locale(spa)); } else { // missing data, install it Intent installIntent = new Intent(); installIntent.setAction( TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); } } } @Override public void onInit(int arg0) { // TODO Auto-generated method stub }} -- -- 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 prompt the user only to download one language? (Text To Speech)
Hi I'm trying to do a text to speech test application, seeing this tutorial: http://android-developers.blogspot.com.es/2009/09/introduction-to-text-to-speech-in.html I tryed doing what the tutorial says, and i'm setting the language only to spanish: mTts = new TextToSpeech(this, this); mTts.setLanguage(new Locale(spa)); The problem is that when the app starts, the app prompts me to a screen asking me download four languages, GERMAN, SPANISH, FRENCH, ITALIAN. If i only download spanish language and then i press back key, the app works, but EACH TIME i start the app, it shows me the same screen to download the other three languages, and only stop appearing if i download the foru languages. My objective is to prompt the user to download ONLY spanish, and to show the languages download dialog only one time, not allways. I'm testing it on a Nexus S phone with 4.1 This is the full code: public class MainActivity extends Activity implements OnInitListener { private static final int MY_DATA_CHECK_CODE = 0; EditText editText; Button button; private TextToSpeech mTts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id.editText); button = (Button) findViewById(R.id.button); editText.setText(Estoy probando, probando y probando, porque hay que probar.); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, MY_DATA_CHECK_CODE); mTts = new TextToSpeech(this, this); mTts.isLanguageAvailable(new Locale(spa)); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mTts.speak(editText.getText().toString(), TextToSpeech.QUEUE_FLUSH, null); } }); -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- 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 to prompt the user only to download one language? (Text To Speech)
What you mean with how to construct my spanish Locale? how can i do that? El martes, 12 de febrero de 2013 10:49:47 UTC+1, skink escribió: iterate over all Locales by calling Locale.getAvailableLocales() and see how to construct your spanish Locale 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] Re: How to prompt the user only to download one language? (Text To Speech)
thanks for your amazing help, now i'm a wonderfull developer El martes, 12 de febrero de 2013 11:57:01 UTC+1, skink escribió: saex wrote: What you mean with how to construct my spanish Locale? how can i do that? construct == build == create in java it mostly applies to using class constructor 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] Problems with Text To Speech
Hi I'm trying to do a text to speech test application, seeing this tutorial: http://android-developers.blogspot.com.es/2009/09/introduction-to-text-to-speech-in.html I tryed doing what the tutorial says, and i'm setting the language only to spanish: mTts = new TextToSpeech(this, this); Locale loc = new Locale (spa, ESP); mTts.setLanguage(loc); The problem is that when the app starts, the app prompts me to a screen asking me download four languages, GERMAN, SPANISH, FRENCH, ITALIAN. If i only download spanish language and then i press back key, the app works, but EACH TIME i start the app, it shows me the same screen to download the other three languages, and only stop appearing if i download the foru languages. My objective is to prompt the user to download ONLY spanish, and to show the languages download dialog only one time, not allways. I'm testing it on a Nexus S phone with 4.1 This is the full code: public class MainActivity extends Activity implements OnInitListener { private static final int MY_DATA_CHECK_CODE = 0; EditText editText; Button button; private TextToSpeech mTts; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id.editText); button = (Button) findViewById(R.id.button); editText.setText(Estoy probando, porque hay que probar.); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, MY_DATA_CHECK_CODE); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mTts.speak(editText.getText().toString(), TextToSpeech.QUEUE_FLUSH, null); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == MY_DATA_CHECK_CODE) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { // success, create the TTS instance mTts = new TextToSpeech(this, this); Locale loc = new Locale (spa, ESP); mTts.setLanguage(loc); } else { // missing data, install it Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); mTts = new TextToSpeech(this, this); Locale loc = new Locale (spa, ESP); mTts.setLanguage(loc); } } } @Override public void onInit(int arg0) {}} -- -- 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: Problems with Text To Speech
I checked in docens of posts and i can't find another way to construct my spanish locale. Please, try to make a better explained answer or to test your answer before writting it. El martes, 12 de febrero de 2013 17:35:50 UTC+1, skink escribió: iterate over all Locales by calling Locale.getAvailableLocales () and learn how to construct your spanish Locale 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] It is possible to show a route between two POINTS selecting the type of transport?
Hi I'm showing a route between two points with this code: Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(http://maps.google.com/maps?saddr=+lastLocation.getLatitude()+,+lastLocation.getLongitude()+daddr=+(double)point.getLatitudeE6()/100+,+(double)point.getLongitudeE6()/100)); intent.setClassName(com.google.android.apps.maps, com.google.android.maps.MapsActivity); startActivity(intent); This code works perfectly, but I need to add to that code the possibility to select for example, public transport. It is possible? -- -- 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] Issues getting Galaxy Nexus (4.2.1) Camera Megapixels with this function
Hi I'm getting the camera megapixels with this function: private String getCameraMegapixels(Camera cam){ Camera.Size size; size = cam.getParameters().getPictureSize(); DecimalFormat localDecimalFormat = new DecimalFormat(#.#); return localDecimalFormat.format(size.width * size.height / 100.0D); } It works fine for front and back camera in all the phones i tested but but in Galaxy nexus. In galaxy nexus something is going wrong because i'm getting that the camera (front and back) haves 0.1 megapixels Is something wrong with galaxy nexus and the way to get megapixels? PD: Galaxy Nexus Android version is 4.2.1 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: Issues getting Galaxy Nexus (4.2.1) Camera Megapixels with this function
the camera is set to maximum res, and also, both cameras gives me 0.1 megapixels, front and back, so i'm sure the solution is not this El lunes, 4 de febrero de 2013 18:53:32 UTC+1, Nobu Games escribió: If I'm not totally mistaken Camera.getParameters stores the currently set camera parameters. What if the camera resolution has been set to the lowest available? I think you need to scan through the result of getSupportedPictureSizes()http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getSupportedPictureSizes%28%29and find the highest available resolution from there. On Monday, February 4, 2013 11:42:51 AM UTC-6, saex wrote: Hi I'm getting the camera megapixels with this function: private String getCameraMegapixels(Camera cam){ Camera.Size size; size = cam.getParameters().getPictureSize(); DecimalFormat localDecimalFormat = new DecimalFormat(#.#); return localDecimalFormat.format(size.width * size.height / 100.0D); } It works fine for front and back camera in all the phones i tested but but in Galaxy nexus. In galaxy nexus something is going wrong because i'm getting that the camera (front and back) haves 0.1 megapixels Is something wrong with galaxy nexus and the way to get megapixels? PD: Galaxy Nexus Android version is 4.2.1 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] Efficient way to update one of the childs of a ExpandableListView group?
OK, Sorry guys, now i understand you I tryed using your answers to get the solution but it doesn't works by now, i don't know what i'm doing wrong This is the code now (this code is on the handler that is being called each second from a thread). el is the expandableListView and mAdapter is the adapter for the expandableListView TextView tv = (TextView) mAdapter.getChildView(1, 0, true, (TextView)el.getChildAt(1), el); tv.setText(My New Text); The child is not changing, so something is going wrong... :/ El sábado, 2 de febrero de 2013 09:44:25 UTC+1, skink escribió: Lew wrote: saex wrote: argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is not the problem, read the full post please Instead of bitching and shouting at everyone trying to help you for free, which is a pretty darn good way to stop receiving free help altogether as people start to resent your chastisements, how about you - attempt to follow their advice, and - post an SSCCE http://sscce.org/ illustrating your attempt. Follow this advice also: http://www.catb.org/esr/faqs/smart-questions.html -- Lew and of course good old Google is his friend, quick search like this: http://www.google.com/m?q=android+listview+update+single+item shows some SO answers, for ex: http://stackoverflow.com/questions/2123083/android-listview-refresh-single-row 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.
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
public class CustomExpandableListAdapter extends BaseExpandableListAdapter { AbsListView.LayoutParams lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); SpannableString spanString=null; String[] groups; String[][] children; Context context; public CustomExpandableListAdapter(Context context, String[] groups, String[][] children) { super(); this.groups = groups; this.children = children; this.context = context; } public Object getChild(int groupPosition, int childPosition) { return children[groupPosition][childPosition]; } public long getChildId(int groupPosition, int childPosition) { return childPosition; } public int getChildrenCount(int groupPosition) { return children[groupPosition].length; } public TextView getGenericView() { TextView textView = new TextView(context); textView.setLayoutParams(lp); textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); return textView; } public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView auxTextView = getGenericView(); auxTextView.setText(Html.fromHtml(getChild(groupPosition, childPosition).toString())); auxTextView.setTextSize(Util.CHILD_TEXT_SIZE); auxTextView.setPadding(20, 10, 20, 10); auxTextView.setTextColor(Util.FONT_COLOR_CHILD); return auxTextView; } public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { TextView auxTextView = getGenericView(); auxTextView.setTextSize(24); auxTextView.setPadding(10, 10, 10, 10); auxTextView.setTextColor(Util.FONT_COLOR_PARENT); spanString = new SpannableString(getGroup(groupPosition).toString()); spanString.setSpan(new StyleSpan(Typeface.BOLD), 0, spanString.length(), 0); spanString.setSpan(new StyleSpan(Typeface.ITALIC), 0, spanString.length(), 0); auxTextView.setText(spanString); return auxTextView; } public Object getGroup(int groupPosition) { return groups[groupPosition]; } public int getGroupCount() { return groups.length; } public long getGroupId(int groupPosition) { return groupPosition; } public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } public boolean hasStableIds() { return true; } } El lunes, 4 de febrero de 2013 20:11:57 UTC+1, skink escribió: saex wrote: OK, Sorry guys, now i understand you I tryed using your answers to get the solution but it doesn't works by now, i don't know what i'm doing wrong This is the code now (this code is on the handler that is being called each second from a thread). el is the expandableListView and mAdapter is the adapter for the expandableListView TextView tv = (TextView) mAdapter.getChildView(1, 0, true, (TextView)el.getChildAt(1), el); tv.setText(My New Text); The child is not changing, so something is going wrong... :/ what adapter are you extending? 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] Re: Efficient way to update one of the childs of a ExpandableListView group?
Thanks but i dont understand your code I dont know why you are updating with a for. I only want to update a child, and in my activity i know wich child i want to update, is the child 0 of the group 1. Please, can tell me what is wrong in my code? i just can't understand how to adapt your code to my code.. thanks El viernes, 1 de febrero de 2013 09:36:18 UTC+1, saex escribió: I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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: Efficient way to update one of the childs of a ExpandableListView group?
I tryed to adapt your code by adding this into the handler of my activity: int first = el.getFirstVisiblePosition(); int last = el.getLastVisiblePosition(); int cnt = last - first + 1; String tag = Integer.toString(1); for (int i = 0; i cnt; i++) { View v = el.getChildAt(i); if (tag.equals(v.getTag())) { mAdapter.getChildView(1, 0, false, v, el); break; } } Also im adding this to each child view in the madapter: auxTextView.setTag(Integer.toString(groupPosition)); But didn't works, the view is not being updated... please, can you tell me how to correct my code? i can't adapt your code to mine to solve this El lunes, 4 de febrero de 2013 22:16:55 UTC+1, saex escribió: Thanks but i dont understand your code I dont know why you are updating with a for. I only want to update a child, and in my activity i know wich child i want to update, is the child 0 of the group 1. Please, can tell me what is wrong in my code? i just can't understand how to adapt your code to my code.. thanks El viernes, 1 de febrero de 2013 09:36:18 UTC+1, saex escribió: I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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: Efficient way to update one of the childs of a ExpandableListView group?
Oh!! finally i achieved it! nice! thanks a lot! btw it's not fair to iterate until you reach the correct children, it is l inear cost. Does not exist a fastest way to reach the view that you need to update? thanks El lunes, 4 de febrero de 2013 22:24:35 UTC+1, skink escribió: saex wrote: Thanks but i dont understand your code I dont know why you are updating with a for. I only want to update a child, and in my activity i know wich child i want to update, is the child 0 of the group 1. Please, can tell me what is wrong in my code? i just can't understand how to adapt your code to my code.. thanks I need to iterate over all children since I don't know which child to update - I do it comparing a tag which is set previously in getChildView 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] Re: Efficient way to update one of the childs of a ExpandableListView group?
well, i finally did it with TextView v = (TextView)el.findViewById(idx); and setId instead of setTag i think this is fastest than the for, what do you think? El lunes, 4 de febrero de 2013 22:52:57 UTC+1, skink escribió: saex wrote: Oh!! finally i achieved it! nice! thanks a lot! btw it's not fair to iterate until you reach the correct children, it is l inear cost. Does not exist a fastest way to reach the view that you need to update? I don't think its slow: there are max 10 or something visible children, if you still think it's slow use some hashmap 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] Re: Efficient way to update one of the childs of a ExpandableListView group?
And what about this? (from first to last) for (int i = first; i = last; i++) { TextView v = (TextView)el.getChildAt(i); it can give an exception? or it's the better way? thanks El lunes, 4 de febrero de 2013 23:09:49 UTC+1, saex escribió: well, i finally did it with TextView v = (TextView)el.findViewById(idx); and setId instead of setTag i think this is fastest than the for, what do you think? El lunes, 4 de febrero de 2013 22:52:57 UTC+1, skink escribió: saex wrote: Oh!! finally i achieved it! nice! thanks a lot! btw it's not fair to iterate until you reach the correct children, it is l inear cost. Does not exist a fastest way to reach the view that you need to update? I don't think its slow: there are max 10 or something visible children, if you still think it's slow use some hashmap 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] Efficient way to update one of the childs of a ExpandableListView group?
I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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] Efficient way to update one of the childs of a ExpandableListView group?
OK, i can get the childs View with: el.getChildAt(1); el.getChildAt(2); but... what shouild i do to notify these views that they must reload their content from the adapter? El viernes, 1 de febrero de 2013 11:38:42 UTC+1, Kostya Vasilyev escribió: While TreKing's advice to profile is of course excellent... ...rebuilding the entire {expandable} list view just to update one item is more work that necessary. When performance is important, you can walk the list of visible item views, find the one you need to update, and do it right there. You will want to use listView.getFirstVisibleItem / getLastVisibleItem / getChild. Also there is a callback, AbsListView.onScrollListener, which lets you know when the list view is scrolling, and perhaps suspend your updates if necessary. -- K 2013/2/1 saex elpab...@gmail.com javascript: I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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. -- -- 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] Efficient way to update one of the childs of a ExpandableListView group?
i know how to get the views, the problems is that i can't reach the way to tell the adapter to update the content of only these views... did you know? thanks El viernes, 1 de febrero de 2013 12:37:51 UTC+1, Kostya Vasilyev escribió: Might look something like this: final int nFirst = mAccountListView.getFirstVisiblePosition(); final int nLast = mAccountListView.getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(position - nFirst); As for asking the adapter to update the view, well, there isn't a direct way to do this. You could call the adapter's getView, making sure to pass the existing view as the convertView. Or just reach into the content of your item layout (findViewById, ViewHolder) and update the values. If the number of items in the adapter can change dynamically, it gets more complicated, as the list view can be out of sync with the adapter. And remember, this can be considered an ugly hack that violates the holy principles of Objectively Orientated Progammation (or whatever that thing is called) :) -- but can be useful where performance is important. -- K 2013/2/1 saex elpab...@gmail.com javascript: OK, i can get the childs View with: el.getChildAt(1); el.getChildAt(2); but... what shouild i do to notify these views that they must reload their content from the adapter? El viernes, 1 de febrero de 2013 11:38:42 UTC+1, Kostya Vasilyev escribió: While TreKing's advice to profile is of course excellent... ...rebuilding the entire {expandable} list view just to update one item is more work that necessary. When performance is important, you can walk the list of visible item views, find the one you need to update, and do it right there. You will want to use listView.getFirstVisibleItem / getLastVisibleItem / getChild. Also there is a callback, AbsListView.onScrollListener, which lets you know when the list view is scrolling, and perhaps suspend your updates if necessary. -- K 2013/2/1 saex elpab...@gmail.com I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).** notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(**); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged**(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).** notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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.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 . -- -- 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
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
i didn't understand you, the adapter doesn't have a getView method El viernes, 1 de febrero de 2013 12:50:46 UTC+1, Kostya Vasilyev escribió: Is that it? You could call the adapter's getView, making sure to pass the existing view as the convertView. -- K 2013/2/1 saex elpab...@gmail.com javascript: i know how to get the views, the problems is that i can't reach the way to tell the adapter to update the content of only these views... did you know? thanks El viernes, 1 de febrero de 2013 12:37:51 UTC+1, Kostya Vasilyev escribió: Might look something like this: final int nFirst = mAccountListView.**getFirstVisiblePosition(); final int nLast = mAccountListView.**getLastVisiblePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(**position - nFirst); As for asking the adapter to update the view, well, there isn't a direct way to do this. You could call the adapter's getView, making sure to pass the existing view as the convertView. Or just reach into the content of your item layout (findViewById, ViewHolder) and update the values. If the number of items in the adapter can change dynamically, it gets more complicated, as the list view can be out of sync with the adapter. And remember, this can be considered an ugly hack that violates the holy principles of Objectively Orientated Progammation (or whatever that thing is called) :) -- but can be useful where performance is important. -- K 2013/2/1 saex elpab...@gmail.com OK, i can get the childs View with: el.getChildAt(1); el.getChildAt(2); but... what shouild i do to notify these views that they must reload their content from the adapter? El viernes, 1 de febrero de 2013 11:38:42 UTC+1, Kostya Vasilyev escribió: While TreKing's advice to profile is of course excellent... ...rebuilding the entire {expandable} list view just to update one item is more work that necessary. When performance is important, you can walk the list of visible item views, find the one you need to update, and do it right there. You will want to use listView.getFirstVisibleItem / getLastVisibleItem / getChild. Also there is a callback, AbsListView.onScrollListener, which lets you know when the list view is scrolling, and perhaps suspend your updates if necessary. -- K 2013/2/1 saex elpab...@gmail.com I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second* calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter). **notifyDataSetChanged**(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).**notifyDataSetChanged**(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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.com To unsubscribe from this group, send email to android-developers+**unsubscribe**@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+**unsubscribe**@googlegroups.com. For more options, visit https://groups.google.com/**grou**ps/opt_outhttps://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-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
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
arg... you didn't understand me or i can't understand you getChildView and getGroupView are from the ExpandableListView, but we are talking about the Adapter, i dont know how to update only the view of only the two childs i want to update, please, can you give me code example of what you want to say to me? i can't understand El viernes, 1 de febrero de 2013 13:08:36 UTC+1, Kostya Vasilyev escribió: Urm, for an expandable list view -- getChildView or getGroupView. -- K 2013/2/1 saex elpab...@gmail.com javascript: i didn't understand you, the adapter doesn't have a getView method El viernes, 1 de febrero de 2013 12:50:46 UTC+1, Kostya Vasilyev escribió: Is that it? You could call the adapter's getView, making sure to pass the existing view as the convertView. -- K 2013/2/1 saex elpab...@gmail.com i know how to get the views, the problems is that i can't reach the way to tell the adapter to update the content of only these views... did you know? thanks El viernes, 1 de febrero de 2013 12:37:51 UTC+1, Kostya Vasilyev escribió: Might look something like this: final int nFirst = mAccountListView.**getFirstVisib**lePosition(); final int nLast = mAccountListView.**getLastVisibl**ePosition(); for (int position = nFirst; position = nLast; ++position) { View itemView = mAccountListView.getChildAt(**po**sition - nFirst); As for asking the adapter to update the view, well, there isn't a direct way to do this. You could call the adapter's getView, making sure to pass the existing view as the convertView. Or just reach into the content of your item layout (findViewById, ViewHolder) and update the values. If the number of items in the adapter can change dynamically, it gets more complicated, as the list view can be out of sync with the adapter. And remember, this can be considered an ugly hack that violates the holy principles of Objectively Orientated Progammation (or whatever that thing is called) :) -- but can be useful where performance is important. -- K 2013/2/1 saex elpab...@gmail.com OK, i can get the childs View with: el.getChildAt(1); el.getChildAt(2); but... what shouild i do to notify these views that they must reload their content from the adapter? El viernes, 1 de febrero de 2013 11:38:42 UTC+1, Kostya Vasilyev escribió: While TreKing's advice to profile is of course excellent... ...rebuilding the entire {expandable} list view just to update one item is more work that necessary. When performance is important, you can walk the list of visible item views, find the one you need to update, and do it right there. You will want to use listView.getFirstVisibleItem / getLastVisibleItem / getChild. Also there is a callback, AbsListView.onScrollListener, which lets you know when the list view is scrolling, and perhaps suspend your updates if necessary. -- K 2013/2/1 saex elpab...@gmail.com I have a ExpandableListView with some groups, and each group haves only one child, with a string on it. I have a thread that get's some updated data and *each second*calls a handler that updates the string of one of the childs of the ExpandableListView and then calls this method to refresh the view and show the updated data to the user: ((BaseExpandableListAdapter) mAdapter).**notifyDataSetChanged(); This is the update handler: infoUpdateHandler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); children[2][0]=getUpdatedInfo(**); ((BaseExpandableListAdapter) mAdapter).notifyDataSetChanged**(); } }; The problem is that when i'm scrolling the expandable list view, i can see how the scroll is showing low performance, it stops sometimes. I think that it is because this call ((BaseExpandableListAdapter) mAdapter).**notifyDataSetChanged(); is updating all the ExpandableListView. *Does not exist a better way to update a expandable list view? Maybe a way to update only the child that you want to update?* 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.com To unsubscribe from this group, send email to android-developers+**unsubscribe@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+**unsubscribe @googlegroups.com. For more options, visit https://groups.google.com/**grou ps/opt_out https://groups.google.com/groups/opt_out
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
I see, but i can't understand how to do what i need to do... El viernes, 1 de febrero de 2013 16:03:17 UTC+1, skink escribió: saex wrote: arg... you didn't understand me or i can't understand you getChildView and getGroupView are from the ExpandableListView, but we are talking about the Adapter, no, see http://developer.android.com/reference/android/widget/ExpandableListAdapter.html 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.
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is not the problem, read the full post please El viernes, 1 de febrero de 2013 17:10:53 UTC+1, skink escribió: saex wrote: I see, but i can't understand how to do what i need to do... just call getChildView 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.
Re: [android-developers] Efficient way to update one of the childs of a ExpandableListView group?
What? where should i put that view? i dont understand you... the objective is to update one item instead of rebuilding the entire {expandable} list view. So... what should i do with that view? how can i make that view to be refreshed when i want? i'm stuck El viernes, 1 de febrero de 2013 18:19:57 UTC+1, Kostya Vasilyev escribió: And if you can't call getChildView, just copy the code from there to where you need it. (Can't believe I wrote copy the code... will my developer license be revoked now?) -- K 2013/2/1 skink psk...@gmail.com javascript: saex wrote: argg you didn't understand me. I KNOW HOW TO GET THE VIEW, it is not the problem, read the full post please i did read the full thread and still i think you should call getChildView as Kostya suggested 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-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 get back camera info in android 1.6 to 2.2?
in Android 2.3 (API 9), google introduced CameraInfo to check if the given camera is the back camera or the front camera in a phone with two cameras: http://developer.android.com/reference/android/hardware/Camera.CameraInfo.html With this example you can get info from FRONT camera: How to open front camera on android platform?http://stackoverflow.com/questions/2779002/how-to-open-front-camera-on-android-platformand it's the same for BACK camera. OK, but the problem is that i need to get info from BACK camera in a phone with android 2.2. The phone haves two cameras, front and back, and when i'm trying to get info of the camera, it returns the info of the FRONT CAMERA. I used this code: if (Build.VERSION.SDK_INT = 8){ Camera cam = Camera.open(); s +=buMain Camera:/u/bbrbr; s += bMegapixels: /b+getCameraMegapixels(cam) + megapixels; s += getCamExtraInfo(cam); cam.release(); } I want to get the info from the main camera (the back camera), but that code gives me info from the front camera I'm sure there is a way to get the info from the back camera on Android 2.2 and lower devices. Someone knows it? 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 to check if an Android phone has front and rear facing cameras?
Hi I need to detect if the phone has a front facing camera, and if so, I need to calculate the megapixels. The same thing goes for a rear facing camera. I know how to get the megapixels of a Camera object, but I don't know how to check for the other things. P.s.: I would also be nice if you know a way to check if the Camera has flash or not, and other cool statistics about the camera -- -- 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] ExpandableListView Expand icon overlays the text titles of the items
This is not the solution, i tryed it, but the padding is insufficient on some large screen phones. And i if put a lot of padding the text appears a lot to the right on smal screen resolution phones. I'm sure that exist's better solution for this El martes, 22 de enero de 2013 01:23:34 UTC+1, TreKing escribió: On Mon, Jan 21, 2013 at 4:32 PM, saex elpab...@gmail.com javascript:wrote: The icon is being painted overlaying the text title of each item. It means that for example, if the title of the first items is Ducados, the icon is overlaying Du and only cados is visible What can i do to align the text on the right of the expand icon? Add some padding to the left side of the TextView you use for the items. - 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
[android-developers] ExpandableListView Expand icon overlays the text titles of the items
i have a ExpanableListView that i'm texting. I have a problem with the expand icon of the items. The icon is being painted overlaying the text title of each item. It means that for example, if the title of the first items is Ducados, the icon is overlaying Du and only cados is visible What can i do to align the text on the right of the expand icon? this is the code: public class MainActivity extends ExpandableListActivity {ExpandableListAdapter mAdapter; @Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set up our adapter mAdapter = new MyExpandableListAdapter(); setListAdapter(mAdapter); registerForContextMenu(getExpandableListView());} @Overridepublic void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderTitle(Sample menu); menu.add(0, 0, 0, Sample action);} @Overridepublic boolean onContextItemSelected(MenuItem item) { ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo(); String title = ((TextView) info.targetView).getText().toString(); int type = ExpandableListView.getPackedPositionType(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition); int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition); Toast.makeText(this, title + : Child + childPos + clicked in group + groupPos, Toast.LENGTH_SHORT).show(); return true; } else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition); Toast.makeText(this, title + : Group + groupPos + clicked, Toast.LENGTH_SHORT).show(); return true; } return false;} public class MyExpandableListAdapter extends BaseExpandableListAdapter { // Sample data set. children[i] contains the children (String[]) for groups[i]. private String[] groups = { Names, Designation, Gender, Company }; private String[][] children = { { abc, xyz, ash, anu }, { SSE, TJ, PM, SE }, { Male, Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female Female }, { yy, x } }; public Object getChild(int groupPosition, int childPosition) { return children[groupPosition][childPosition]; } public long getChildId(int groupPosition, int childPosition) { return childPosition; } public int getChildrenCount(int groupPosition) { return children[groupPosition].length; } public TextView getGenericView() { // Layout parameters for the ExpandableListView AbsListView.LayoutParams lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); TextView textView = new TextView(MainActivity.this); textView.setLayoutParams(lp); textView.setTextSize(20); // Center the text vertically textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); return textView; } public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getChild(groupPosition, childPosition).toString()); textView.setTextSize(15); return textView; } public Object getGroup(int groupPosition) { return groups[groupPosition]; } public int getGroupCount() { return groups.length; } public long getGroupId(int groupPosition) { return groupPosition; } public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getGroup(groupPosition).toString()); return textView; } public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } public boolean hasStableIds() { return true; } }} -- 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] LEFT JOIN and ORDER BY modified behavior between android 4 and lower versions?
i have an app that makes this SQL query to a database with two tables, a table with items and a table with datesets. Each dataset can be from a item, and it is a set of dates ( :) ) SELECT distinct items.date from items left join datesets on items.inicio=datesets.capoID and items.capoID=datesets.capoID ORDER BY datesets.date I am ordering by datesets.date because date is a integer representing the date, for example: 1357340400 On android 4.X phones the query gives me correctly ordered result. The result of the query is: 11-28 13:24:09.457: I/System.out(9148): 16-03-201211-28 13:24:09.457: I/System.out(9148): 01-06-201211-28 13:24:09.457: I/System.out(9148): 22-06-201211-28 13:24:09.457: I/System.out(9148): 21-07-201211-28 13:24:09.457: I/System.out(9148): 26-09-201211-28 13:24:09.457: I/System.out(9148): 30-10-201211-28 13:24:09.457: I/System.out(9148): 05-12-201211-28 13:24:09.457: I/System.out(9148): 08-12-201211-28 13:24:09.457: I/System.out(9148): 27-12-201211-28 13:24:09.457: I/System.out(9148): 05-01-201311-28 13:24:09.457: I/System.out(9148): 25-02-201311-28 13:24:09.457: I/System.out(9148): 10-03-201311-28 13:24:09.457: I/System.out(9148): 23-04-201311-28 13:24:09.457: I/System.out(9148): 27-04-201311-28 13:24:09.457: I/System.out(9148): 11-05-201311-28 13:24:09.457: I/System.out(9148): 23-06-201311-28 13:24:09.457: I/System.out(9148): 01-07-201311-28 13:24:09.457: I/System.out(9148): 15-08-201311-28 13:24:09.457: I/System.out(9148): 11-09-201311-28 13:24:09.457: I/System.out(9148): 21-09-2013 In Android 3.2, 2.3, etc (lower versions than 4), the result is incorrect, is not properly ordered: 11-28 13:22:50.734: I/System.out(3181): 01-06-201211-28 13:22:50.734: I/System.out(3181): 16-03-201211-28 13:22:50.734: I/System.out(3181): 21-07-201211-28 13:22:50.734: I/System.out(3181): 26-09-201211-28 13:22:50.734: I/System.out(3181): 22-06-201211-28 13:22:50.734: I/System.out(3181): 30-10-201211-28 13:22:50.734: I/System.out(3181): 08-12-201211-28 13:22:50.734: I/System.out(3181): 27-12-201211-28 13:22:50.734: I/System.out(3181): 05-01-201311-28 13:22:50.734: I/System.out(3181): 05-12-201211-28 13:22:50.734: I/System.out(3181): 25-02-201311-28 13:22:50.734: I/System.out(3181): 10-03-201311-28 13:22:50.734: I/System.out(3181): 23-04-201311-28 13:22:50.734: I/System.out(3181): 27-04-201311-28 13:22:50.734: I/System.out(3181): 11-05-201311-28 13:22:50.734: I/System.out(3181): 23-06-201311-28 13:22:50.734: I/System.out(3181): 01-07-201311-28 13:22:50.734: I/System.out(3181): 15-08-201311-28 13:22:50.734: I/System.out(3181): 11-09-201311-28 13:22:50.734: I/System.out(3181): 21-09-2013 -- 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: No sample tutorials for Paypal Mobile Express Checkout with Button in the app?
I know it, and i still need sample code examples with button in the app... El lunes, 29 de octubre de 2012 16:20:18 UTC+1, John Coryat escribió: You may run into other problems using PayPal to collect money through your Android app. The only allowed use of a non-Google Play payer is for physical goods or services. If you plan on submitting your finished app to Google Play, it will now be rejected if you user a payer other than Google Play. This was in the news lately. You may have missed it. -John Coryat On Monday, October 29, 2012 9:54:10 AM UTC-5, saex wrote: I'm testing the sample app for Mobile Express Checkout Library with Android. This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip There are two ways to do the checkout, with the button on the mobile App and with the button in the mobile webpage. I need to use the first way, with the button in the mobile app. The problem is that on the ZIP exists only one sample, and the sample is for the button in the mobile web app. In the IOS version of the zip are two examples, one for each type of express checkout connection. Where can i find code examples for Paypal Mobile Express Checkout with Button in 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] Differences between Google Play Installed Apps “UPDATES” list vs “MANUAL UPDATES” list?
When i enter to googleplay on the phone and i enter to my apps section, i can see all my installed apps spread into three lists: - UPDATES - MANUAL UPDATES - UP TO DATE I published my app into google play and always i launch a new version, my app appears into MANUAL UPDATES list. I want that my app appear into UPDATES list and not MANUAL UPDATES. ¿How can i achieve that? ¿wich is the difference between updates and manual updates on that list? 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] Authentication failed with Paypal Mobile Express Checkout Library sample app
i'm testing the sample app for Mobile Express Checkout Library with Android. This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip When i press the review order button it calls to this method: PayPal.fetchDeviceReferenceTokenWithAppID(this, appID, server, new ResultDelegate()); Something is not working on the sample app because i'm getting this on logcat: 10-29 12:21:28.659: W/System.err(32488): java.lang.NullPointerException10-29 12:21:28.659: W/System.err(32488):at libcore.net.UriCodec.encode(UriCodec.java:132)10-29 12:21:28.659: W/System.err(32488):at java.net.URLEncoder.encode(URLEncoder.java:57)10-29 12:21:28.659: W/System.err(32488):at com.paypal.android.a.c.g(Unknown Source)10-29 12:21:28.659: W/System.err(32488):at com.paypal.android.a.c.e(Unknown Source)10-29 12:21:28.659: W/System.err(32488):at com.paypal.android.a.c.b(Unknown Source)10-29 12:21:28.659: W/System.err(32488):at com.paypal.android.a.d.run(Unknown Source) 10-29 12:21:30.589: E/Error(32488): Authentication failed, button not enabled.10-29 12:21:30.599: W/System.err(32488): java.lang.NullPointerException10-29 12:21:30.599: W/System.err(32488):at com.paypal.android.a.c.a(Unknown Source)10-29 12:21:30.599: W/System.err(32488):at com.paypal.android.a.c.e(Unknown Source)10-29 12:21:30.599: W/System.err(32488):at com.paypal.android.a.c.b(Unknown Source)10-29 12:21:30.599: W/System.err(32488):at com.paypal.android.a.d.run(Unknown Source) I simply opened the sample code project and executed it. I didn't modify anything on the code. -- 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] No sample tutorials for Paypal Mobile Express Checkout with Button in the app?
I'm testing the sample app for Mobile Express Checkout Library with Android. This is the link to the project and the library: https://www.x.com/sites/default/files/PayPal_MECL_1.0_Android-Developer-Package_0.zip There are two ways to do the checkout, with the button on the mobile App and with the button in the mobile webpage. I need to use the first way, with the button in the mobile app. The problem is that on the ZIP exists only one sample, and the sample is for the button in the mobile web app. In the IOS version of the zip are two examples, one for each type of express checkout connection. Where can i find code examples for Paypal Mobile Express Checkout with Button in 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] It is possible to stop a thread that is connecting to URL with httpConnection.connect()?
i have a thread that is connecting to a url to obtaining some data. Sometimes the method httpConnection.connect(); taked too munch time to get the response, and i want to limit the loading dialog of this connection thread to 5 seg. I tryed adding timeouts into the code, *but it doesn't work*!! URL formattedUrl = new URL(url); URLConnection connection = formattedUrl.openConnection(); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); HttpURLConnection httpConnection = (HttpURLConnection) connection; httpConnection.setAllowUserInteraction(false); httpConnection.setInstanceFollowRedirects(true); httpConnection.setRequestMethod(GET); httpConnection.setConnectTimeout(5000); httpConnection.setReadTimeout(5000); httpConnection.connect(); So, i must stop the connect method and the thread when 5000 seconds have passed or when the used has pressed the back key on the phone. How can this be achieved? i can't find info about doing this work in android with a url connection thread. 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] Ordering with SQLITE by nearest latitude longitude coordinates
I must obtain a SQLite SQL Sentence for ordering by nearest latitude and longitude coordinates, given a initial location. THis is a example sentence for my table in the sqlite database: SELECT id, name, lat, lng FROM items I must achieve this with SQLite, and with that table. I can't use another techniques because this is for a existen SQlite database that i can't change. Exists a way to achieve this with Android and SQlite? I checked a lot of stackoverflow posts and i didn't find the way to achieve that 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: Ordering with SQLITE by nearest latitude longitude coordinates
How can i add that function to my sqlite database in Android? and how can i use it ? thanks El lunes, 1 de octubre de 2012 14:11:06 UTC+2, RichardC escribió: http://stackoverflow.com/questions/3168904/sql-query-to-query-nearby-points-of-interest-based-on-lat-long-sqlite On Monday, October 1, 2012 12:53:58 PM UTC+1, saex wrote: I must obtain a SQLite SQL Sentence for ordering by nearest latitude and longitude coordinates, given a initial location. THis is a example sentence for my table in the sqlite database: SELECT id, name, lat, lng FROM items I must achieve this with SQLite, and with that table. I can't use another techniques because this is for a existen SQlite database that i can't change. Exists a way to achieve this with Android and SQlite? I checked a lot of stackoverflow posts and i didn't find the way to achieve that 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: Ordering with SQLITE by nearest latitude longitude coordinates
Obviously the function of the accepted answer. El lunes, 1 de octubre de 2012 15:42:59 UTC+2, RichardC escribió: What function? You need to put more effort into your questions, do not expect others to do all your work for you. On Monday, October 1, 2012 2:34:32 PM UTC+1, saex wrote: How can i add that function to my sqlite database in Android? and how can i use it ? thanks El lunes, 1 de octubre de 2012 14:11:06 UTC+2, RichardC escribió: http://stackoverflow.com/questions/3168904/sql-query-to-query-nearby-points-of-interest-based-on-lat-long-sqlite On Monday, October 1, 2012 12:53:58 PM UTC+1, saex wrote: I must obtain a SQLite SQL Sentence for ordering by nearest latitude and longitude coordinates, given a initial location. THis is a example sentence for my table in the sqlite database: SELECT id, name, lat, lng FROM items I must achieve this with SQLite, and with that table. I can't use another techniques because this is for a existen SQlite database that i can't change. Exists a way to achieve this with Android and SQlite? I checked a lot of stackoverflow posts and i didn't find the way to achieve that 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] HorizontalScrollView inside HorizontalScrollView ¿making it possible?
I want to learn how to solve this problem. I want to have a Horizontal scrollview with the scroll blocked (the user should not be able to scroll it) and inside that horizontal scrollview i want to have another horizontal scroll view, and this scrollview must be able to be scrolled by the user (it haves more content that the width of the screen). It is possible to do it? i tryed using this on the parent horizontal scroll view: ((HorizontalScrollView) view).setHorizontalScrollBarEnabled(false); ((HorizontalScrollView) view).setEnabled(false); ((HorizontalScrollView) view).setFocusable(false); ((HorizontalScrollView) view).setFocusableInTouchMode(false); and this on the child horizontal scroll view: ((HorizontalScrollView) view).requestFocus(); It is not working, The child appears to have a scroll bar but it cannot be scrolled. How can this be solved? PD: I know that this is not a good practice, but i want to learn how to achieve this goal. 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] Problems invalidating a View
I have an app with a layout that loads some remote images. When the remote image is being loaded, a clock with 100 forced height is being displayed (i did it overwriting onDraw from imageview), and when the remote image is downloaded and ready to be displayed, the clock dissapears and then the image appears. It works, but when the image appears did not receive the correct height, it still haves the height of the clock (100). I dont know why, because when the image is displayed it calls a handler wich refresh the view of the image and the container layout of the image with the new height (365), but it is not working properly. this is the handler: Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { super.handleMessage(msg); if( ((ImageView)view) != null resource != null resource.image != null ){ ((ImageView)view).setImageBitmap( resource.image ); view.getLayoutParams().height=height; ((ViewGroup)view.getParent()).getLayoutParams().height=height; ((ImageView)view).invalidate(); ((ViewGroup)view.getParent()).invalidate(); ((ViewGroup)view.getParent()).refreshDrawableState(); view.invalidate(); } } }; the handler is being called, the image is being displayed, the height value on the handler is correct (365), but the image is still being displayed with the height of the clock (100). *Also i must say that if i block the screen and unblock the screen, the image appears with the correct height* (365). It seems that there is a problem with invalidate(). Thanks all -- 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] Sending notifications to Google Cloud Messaging with php gives me Unauthorized Error 401
Searching for some info about how to send notifications using GCM but with PHP instead of servlets, i found this: http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging I tested the working code of the responses of these questions, also i created a Key for browser apps (with referers), and i give permissions to this ip: *.mywebsite.com/* (te php file is on this url: http://www.mywebsite.com/~jma/cHtml5/cap/kk.php;) But i'm getting this response: **Unauthorized Error 401** What i'm doing wrong? this is the php file: ?php // Replace with real server API key from Google APIs $apiKey = fictional key; // Replace with real client registration IDs $registrationIDs = array( APA91asdasdSDGGS232S13S4213abGqiNhCIXKjlxrkUYe_xTgTacNGB5n16b380XDd8i_9HpKGRHkvm8DDet4_WK3zumjDEKkTRWLgPS7kO-BrKzWz7eWFQaDD9PJ8zA6hlSqL9_zH21P8K22ktGKmo_VIF6YAdU9ejJovrKBTpgQktYkBZBf9Zw,APAasdasd32423dADFG91bHYYxYB7bFiX5ltbJt6A-4MBiNg7l4RS4Bqf3jIfYviaaUfZ810XJo2o66DY9-jdeJk_JR8FIZCyrmCv-eu_WLkGZ8KaoHgEDR_16H2QPm98uHpe1MjKVXbzYc4J89WMmcIrl5tHhWQnIQNzaI6Zp6yyFUNUQ); // Message to be sent $message = Test Notificación PHP; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' = $registrationIDs, 'data' = array( message = $message ), ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); //curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //curl_setopt($ch, CURLOPT_POST, true); //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $fields )); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; //print_r($result); //var_dump($result); ? -- 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: Sending notifications to Google Cloud Messaging with php gives me Unauthorized Error 401
Solved!!! you must use Key for server apps (with IP locking) instead of browser key :) El miércoles, 5 de septiembre de 2012 17:49:30 UTC+2, saex escribió: Searching for some info about how to send notifications using GCM but with PHP instead of servlets, i found this: http://stackoverflow.com/questions/11242743/gcm-with-php-google-cloud-messaging I tested the working code of the responses of these questions, also i created a Key for browser apps (with referers), and i give permissions to this ip: *.mywebsite.com/* (te php file is on this url: http://www.mywebsite.com/~jma/cHtml5/cap/kk.php;) But i'm getting this response: **Unauthorized Error 401** What i'm doing wrong? this is the php file: ?php // Replace with real server API key from Google APIs $apiKey = fictional key; // Replace with real client registration IDs $registrationIDs = array( APA91asdasdSDGGS232S13S4213abGqiNhCIXKjlxrkUYe_xTgTacNGB5n16b380XDd8i_9HpKGRHkvm8DDet4_WK3zumjDEKkTRWLgPS7kO-BrKzWz7eWFQaDD9PJ8zA6hlSqL9_zH21P8K22ktGKmo_VIF6YAdU9ejJovrKBTpgQktYkBZBf9Zw,APAasdasd32423dADFG91bHYYxYB7bFiX5ltbJt6A-4MBiNg7l4RS4Bqf3jIfYviaaUfZ810XJo2o66DY9-jdeJk_JR8FIZCyrmCv-eu_WLkGZ8KaoHgEDR_16H2QPm98uHpe1MjKVXbzYc4J89WMmcIrl5tHhWQnIQNzaI6Zp6yyFUNUQ); // Message to be sent $message = Test Notificación PHP; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array( 'registration_ids' = $registrationIDs, 'data' = array( message = $message ), ); $headers = array( 'Authorization: key=' . $apiKey, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); //curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //curl_setopt($ch, CURLOPT_POST, true); //curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $fields )); // Execute post $result = curl_exec($ch); // Close connection curl_close($ch); echo $result; //print_r($result); //var_dump($result); ? -- 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] ObjectInput.readObject() for reading a file object didn't work's when the version of the app is newer than the older app wich creates the object
i have this class: public class SaveState implements Serializable { private static final long serialVersionUID = 1L; public ListString downloadedMagazinesIds = new ArrayListString();//id's de revistas descargadas public ListString downloadedMagazinesSummaries = new ArrayListString();//página sumario de cada magazine public ListFullMagazine downloadedMagazines = new ArrayListFullMagazine();//todos los magazines bajados public Magazines ms=null; //Esta clase contiene el array de previews de revistas generado con el parser de XML } And i use these methods to store the class (SaveState object) in the sdcard and to read the object from the file into an object again: public static void saveData(){ ObjectOutput out; try { //primero comprobamos si existe el directorio, y si no, lo creamos. File folder = new File(Environment.getExternalStorageDirectory() + /Couche/); if(!folder.exists()) folder.mkdirs(); File outFile = new File(Environment.getExternalStorageDirectory(), /Couche/appSaveState.data); out = new ObjectOutputStream(new FileOutputStream(outFile)); out.writeObject(saveState); out.close(); } catch (Exception e) {e.printStackTrace();} } public static void loadData(){ ObjectInput in; try { File inFile = new File(Environment.getExternalStorageDirectory(), /Couche/appSaveState.data); in = new ObjectInputStream(new FileInputStream(inFile)); saveState=(SaveState) in.readObject(); in.close(); } catch (Exception e) {e.printStackTrace();} } I store the object and each time my app is closed and i read the object from the sdcard each time my app is opened and it works fine. The problem comes when i created a newer version of my app (1.01). When i start the app and i try to read the file from the sdcard the file is readed but all the variables of the object class are empty. and they are really not empty. What is happening? how can i avoid that? 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] ObjectInput.readObject() for reading a file object didn't work's when the version of the app is newer than the older app wich creates the object
i have this class: public class SaveState implements Serializable { private static final long serialVersionUID = 1L; public ListString downloadedMagazinesIds = new ArrayListString();//id's de revistas descargadas public ListString downloadedMagazinesSummaries = new ArrayListString();//página sumario de cada magazine public ListFullMagazine downloadedMagazines = new ArrayListFullMagazine();//todos los magazines bajados public Magazines ms=null; //Esta clase contiene el array de previews de revistas generado con el parser de XML } And i use these methods to store the class (SaveState object) in the sdcard and to read the object from the file into an object again: public static void saveData(){ ObjectOutput out; try { //primero comprobamos si existe el directorio, y si no, lo creamos. File folder = new File(Environment.getExternalStorageDirectory() + /C/); if(!folder.exists()) folder.mkdirs(); File outFile = new File(Environment.getExternalStorageDirectory(), /C/appSaveState.data); out = new ObjectOutputStream(new FileOutputStream(outFile)); out.writeObject(saveState); out.close(); } catch (Exception e) {e.printStackTrace();} } public static void loadData(){ ObjectInput in; try { File inFile = new File(Environment.getExternalStorageDirectory(), /C/appSaveState.data); in = new ObjectInputStream(new FileInputStream(inFile)); saveState=(SaveState) in.readObject(); in.close(); } catch (Exception e) {e.printStackTrace();} } I store the object and each time my app is closed and i read the object from the sdcard each time my app is opened and it works fine. The problem comes when i created a newer version of my app (1.01). When i start the app and i try to read the file from the sdcard the file is readed but all the variables of the object class are empty. and they are really not empty. What is happening? how can i avoid that? 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] It is possible to add IOS Style rear Shadows into Android ImageViews?
Hi I'm trying to add these kind of IOS shadows in the back of a imageview on Android: [image: enter image description here] I mean the rear shadow in the back of each square. Imagine that each square is an Android IMAGEVIEW, how can i add this shadow in Android? 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] Problems with HttpClient when the function is used by various devices at same time
Using httpclient (apache credentials) connection to download various bitmaps with various devices is failing with one is working OK, ¿why? i'm developing an app for android (java) that it is connecting to a server to download 50 bitmaps, and i'm using this function each time to download each bitmap: public static Bitmap getRemoteBitmap(String url) { Bitmap bm=null; HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; try { ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials( new org.apache.http.auth.AuthScope(null,-1), new org.apache.http.auth.UsernamePasswordCredentials(MagazineStatus._username, MagazineStatus._password)); response = httpclient.execute(new HttpGet(url)); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK) { try { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); bm=BitmapFactory.decodeStream(content ); }catch(Exception ex) {Log.e(DBF Error,ex.toString());} }else { response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } }catch(ClientProtocolException cpe) {Log.e(ClientProtocolException @ at FPT,cpe.toString());} catch(Exception ex) {Log.e(Exception at FETCHPROJECTASK,ex.toString());} return bm; } If i try to download the bitmaps with one device, it works fine, but if i try to download the bitmaps with 3 or 4 devices at the same time, then, something fails on this function because this line bm=BitmapFactory.decodeStream(content ); is giving me a a null bitmap, and i dont understand why, because content, entity, statusLine and response are not null. These are the values for these variables when the bitmap bm is null: response: response (id=830078599368) entity BasicManagedEntity (id=830078617768) headergroup HeaderGroup (id=830078599408) locale Locale (id=830078292336) params ClientParamsStack (id=830079041944) reasonCatalog EnglishReasonPhraseCatalog (id=830004685872) statusline BasicStatusLine (id=830078599344) statusLine: statusLine (id=830078599344) protoVersionHttpVersion (id=830004713800) reasonPhraseOK (id=830078599288) statusCode 200 entity: entity (id=830078617768) attemptReusefalse managedConn null wrappedEntity BasicHttpEntity (id=830078612272) content: content(id=830078617792) skipBuf null eofWatcher BasicManagedEntity (id=830078617768) selfClosed false I'm doing something wrong? is the connection closed properly? can this be improved? Any help will be apreciated. 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] Receiving erroneous glitch bitmaps from httclient connection ¿what i'm doing wrong?
I'm connecting to a server to get 50 bitmaps, and i'm using this function for each bitmap: public static Bitmap getRemoteBitmap(String url) { int cont=0; //reintentos Bitmap bm = null; do{ if (bm != null){ if (bm.isRecycled()==false) bm.recycle(); bm=null; } HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; try { ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials( new org.apache.http.auth.AuthScope(null,-1), new org.apache.http.auth.UsernamePasswordCredentials(MagazineStatus._username, MagazineStatus._password)); response = httpclient.execute(new HttpGet(url)); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK) { try { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); bm=BitmapFactory.decodeStream(content ); content.close(); entity.consumeContent(); System.out.println(); }catch(Exception ex) {Log.e(DBF Error,ex.toString());} }else { response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } }catch(ClientProtocolException cpe) {Log.e(ClientProtocolException @ at FPT,cpe.toString());} catch(Exception ex) {Log.e(Exception at FETCHPROJECTASK,ex.toString());} cont++; }while (bm==null cont11); System.out.println(INTENTOS PARA BAJARLA: +cont); return bm; } After that, i'm compressing the bitmap with pageBitmap.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(Environment.getExternalStorageDirectory()+/Dir/+fm.getId()+/+i+.jpg))); Sometimes is working fine, but sometimes i'm receiving glitched bitmaps like this: [image: Glitched bitmap] I think that the erroneal bitmap is being received only when the function must retry itself with another do while iteration. This happens only with the httpclient connection fails and returns a null bitmap. -- 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] Showing two simultaneously Activities (one smaller), the bigger one doesn't listen to finger events
I am showing two activities, one activitie bigger than the other. The bigger activity haves some buttons and the smaller activity also haves some buttons. The bigger activity launchs the smaller activity, and then, the bigger activity stops listening for finger events (touch on the screen). It is possible to solve this? I need that the two activities can listen to touch events. 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] Showing two simultaneously Activities (one smaller), the bigger one doesn't listen to finger events
I am showing two activities, one activitie bigger than the other. I'm doing it with this: http://iserveandroid.blogspot.com.es/2010/10/how-to-set-heightwidth-for-activity-or.html *I'm not using fragments, i'm not using tabs.* The bigger activity haves some buttons and the smaller activity also haves some buttons. The bigger activity launchs the smaller activity, and then, the bigger activity stops listening for finger events (touch on the screen). It is possible to solve this? I need that the two activities can listen to touch events. 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] Problems putting a RelativeLayout inside a ScrollView
First of all i have a relativeLayout (body_view), and i'm putting a scrollView (viScroll) inside: viScroll = new ScrollView( App.app ); viScroll.setVisibility(View.VISIBLE ); viScroll.setGravity(Gravity.CENTER); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(getDisplayWidth() , RelativeLayout.LayoutParams.FILL_PARENT ); body_view.addView(viScroll , rlp ); Now i'm creating a ButtonContainer relativeLayout wich must have some button views inside: RelativeLayout.LayoutParams rlp2 = new RelativeLayout.LayoutParams( menu_width , RelativeLayout.LayoutParams.FILL_PARENT ); rlp2.setMargins(menu_left, 0, 0 , 0 ); buttonContainer = new RelativeLayout( App.app ); buttonContainer.setGravity(Gravity.CENTER); viScroll.addView(buttonContainer,rlp2); Now i put the buttons inside the ButtonContainer: for( int i = 0 ; i nOptions ; i ++ ){ buttons[i] = new ElementButton( App.app ); buttons[i].addToViewAtEnd( buttonContainer ); } public void addToViewAtEnd( RelativeLayout layout ){ RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams( width , RelativeLayout.LayoutParams.WRAP_CONTENT ); int child_count = layout.getChildCount(); int last_id = child_count 0 ? layout.getChildAt(child_count-1).getId() : 0; rlp.addRule( RelativeLayout.BELOW , last_id ); layout.addView( view , rlp ); } The problem is that my buttonContainer is not being displayed on the center of the viScroll scrollView. If the main layout BodyView haves low height then the buttonContainer is not displayed... something is going wrong and i can't find 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: Opengl ES scaling (zoom out) shows rare square tiles on my textures. How to avoid it?
I tryed it, it is not the solution El sábado, 21 de abril de 2012 20:23:26 UTC+2, Nightwolf escribió: Change zNear and zFar parameters in GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f) to 1 and 1000. If it helps then your square is near far clipping plane. пятница, 20 апреля 2012 г., 19:41:54 UTC+4 пользователь saex написал: Hi I'm displaying a OPENGL ES 1.X square with a texture, and the user can zoom in and out the square scaling it. When the user zoom's out the square (the square get's scaled going smaller in the screen) the texture of the square get's rare translucent squares, like tiles from googlemaps. I think that the scaling function from OpenGL is now working in the better way. How can i improve it? These are my OpenGL GLSurfaceView main functions: public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); //dithering OFF gl.glEnable(GL10.GL_TEXTURE_2D);//Texture Mapping ON gl.glShadeModel(GL10.GL_SMOOTH);//Smooth Shading gl.glClearDepthf(1.0f); //Depth Buffer Setup gl.glEnable(GL10.GL_DEPTH_TEST);//Depth Testing ON gl.glDepthFunc(GL10.GL_LEQUAL); gl.glClearColor(0,0,0,0); //fondo transparente gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Cargamos la textura del cubo. for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).loadGLTexture(gl, context); } } public void onDrawFrame(GL10 gl) { //Limpiamos pantalla y Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); mg.getCurrentProjection(gl); //volvemos a generar las matrices por que es un bucle mg.getCurrentModelView(gl); . . . . gl.glTranslatef(X, Y, Z); //Move z units into the screen gl.glRotatef(zrot, 0.0f, 0.0f, 1.0f); //Z gl.glScalef(scale, scale, 1.0f); for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).draw(gl); //Draw the Cube } } public void onSurfaceChanged(GL10 gl, int width, int height) { if(height == 0) { //Prevent A Divide By Zero By height = 1; //Making Height Equal One } gl.glViewport(0, 0, width, height); //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION);//Select The Projection Matrix gl.glLoadIdentity();//Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix gl.glLoadIdentity();//Reset The Modelview Matrix } and these are my square polygon class main functions: public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CCW); //Bind our only previously generated texture in this case gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } //Carga de texturas public void loadGLTexture(GL10 gl, Context context) { //Generamos un puntero de texturas gl.glDeleteTextures(1, textures, 0); //libero memoria gl.glGenTextures(1, textures, 0); //y se lo asignamos a nuestro array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Creamos filtros de texturas gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); //Diferentes parametros de textura posibles GL10.GL_CLAMP_TO_EDGE gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); //Usamos Android GLUtils para espcificar una textura de 2 dimensiones para nuestro bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); //Checkeamos si el GL context es versión 1.1 y generamos los Mipmaps por Flag
[android-developers] Opengl ES scaling (zoom out) shows rare square tiles on my textures. How to avoid it?
Hi I'm displaying a OPENGL ES 1.X square with a texture, and the user can zoom in and out the square scaling it. When the user zoom's out the square (the square get's scaled going smaller in the screen) the texture of the square get's rare translucent squares, like tiles from googlemaps. I think that the scaling function from OpenGL is now working in the better way. How can i improve it? These are my OpenGL GLSurfaceView main functions: public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); //dithering OFF gl.glEnable(GL10.GL_TEXTURE_2D);//Texture Mapping ON gl.glShadeModel(GL10.GL_SMOOTH);//Smooth Shading gl.glClearDepthf(1.0f); //Depth Buffer Setup gl.glEnable(GL10.GL_DEPTH_TEST);//Depth Testing ON gl.glDepthFunc(GL10.GL_LEQUAL); gl.glClearColor(0,0,0,0); //fondo transparente gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Cargamos la textura del cubo. for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).loadGLTexture(gl, context); } } public void onDrawFrame(GL10 gl) { //Limpiamos pantalla y Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); mg.getCurrentProjection(gl); //volvemos a generar las matrices por que es un bucle mg.getCurrentModelView(gl); . . . . gl.glTranslatef(X, Y, Z); //Move z units into the screen gl.glRotatef(zrot, 0.0f, 0.0f, 1.0f); //Z gl.glScalef(scale, scale, 1.0f); for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).draw(gl); //Draw the Cube } } public void onSurfaceChanged(GL10 gl, int width, int height) { if(height == 0) { //Prevent A Divide By Zero By height = 1; //Making Height Equal One } gl.glViewport(0, 0, width, height); //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION);//Select The Projection Matrix gl.glLoadIdentity();//Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix gl.glLoadIdentity();//Reset The Modelview Matrix } and these are my square polygon class main functions: public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CCW); //Bind our only previously generated texture in this case gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } //Carga de texturas public void loadGLTexture(GL10 gl, Context context) { //Generamos un puntero de texturas gl.glDeleteTextures(1, textures, 0); //libero memoria gl.glGenTextures(1, textures, 0); //y se lo asignamos a nuestro array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Creamos filtros de texturas gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); //Diferentes parametros de textura posibles GL10.GL_CLAMP_TO_EDGE gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); //Usamos Android GLUtils para espcificar una textura de 2 dimensiones para nuestro bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); //Checkeamos si el GL context es versión 1.1 y generamos los Mipmaps por Flag. Si no, llamamos a nuestra propia implementación if(gl instanceof GL11) { gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_GENERATE_MIPMAP, GL11.GL_TRUE); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); } else { buildMipmap(gl, bitmap); } //Limpiamos los bitmaps bitmap.recycle(); bitmap=null; System.gc(); } -- You received this message because you are subscribed to the Google Groups
[android-developers] Problems locking the screen orientation with ActivityInfo.SCREEN_ORIENTATION_NOSENSOR
I have an activity that shows a scrollview with a lot of linearlayouts with a lot of imageviews and textviews. This activity must show two columns in my scrollview if the orientation is landscape, and it must show one column in my scrollview if the orientation is portrait. It works fine. I have this code on the onCreate method: DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); sw=dm.widthPixels; sh=dm.heightPixels; if (swsh) portrait=false; with that code i can check if the screenorientation is portrait or landscape, and then, generate one or two columns in my scrollview. So, each time the user changes the screen orientation, the oncreate get's called again and check wich is the current screen orientation. *As i said, it works fine, but here comes the problem:* This activity shows some buttons for download content from internet using a AsyncTask that shows a horizontal ProgressBar. If i change the orientation while i'm downloading the content from internet and showing the progressBar, then i get a exception like this: 04-11 14:29:22.655: INFO/WindowManager(1086): Setting rotation to 0, animFlags=0 04-11 14:29:22.678: INFO/ActivityManager(1086): Config changed: { scale=1.0 imsi=310/4 loc=en_US touch=3 keys=2/1/2 nav=2/2 orien=1 layout=34 uiMode=17 seq=75} 04-11 14:29:22.717: INFO/UsageStats(1086): Unexpected resume of com.Magazine while already resumed in com.Magazine 04-11 14:29:22.780: ERROR/WindowManager(4791): Activity com.Magazine.MainMenu has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@447a3e68 that was originally added here 04-11 14:29:22.780: ERROR/WindowManager(4791): android.view.WindowLeaked: Activity com.Magazine.MainMenu has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@447a3e68 that was originally added here 04-11 14:29:22.780: ERROR/WindowManager(4791): at android.view.ViewRoot.init(ViewRoot.java:247) Then, i suposed that i must lock the screen orientation changes when the user is downloading content and showing the progressbar dialog, and i tryed it locking and unlocking it with this: ((Activity) context).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); ((Activity) context).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); IT WORK'S FINE IF I'M IN PORTRAIT MODE and after i start downloading something i try to change to landscape, it blocks the change and works finde. *But if i'm in landscape mode and i press the button for download the content from internet and i start the progressbar dialog, then i get this exception, and no need to try to change the orientation to portrait mode, i get the exception instantly:* 04-11 14:33:52.405: INFO/WindowManager(1086): Setting rotation to 0, animFlags=1 04-11 14:33:52.420: INFO/ActivityManager(1086): Config changed: { scale=1.0 imsi=310/4 loc=en_US touch=3 keys=2/1/2 nav=2/2 orien=1 layout=34 uiMode=17 seq=77} 04-11 14:33:52.444: INFO/UsageStats(1086): Unexpected resume of com.Magazine while already resumed in com.Magazine 04-11 14:33:52.952: INFO/global(4831): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required. 04-11 14:33:53.342: DEBUG/dalvikvm(4831): GC_FOR_MALLOC freed 15782 objects / 1323968 bytes in 52ms 04-11 14:33:53.358: ERROR/WindowManager(4831): Activity com.Magazine.MainMenu has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4490f888 that was originally added here 04-11 14:33:53.358: ERROR/WindowManager(4831): android.view.WindowLeaked: Activity com.Magazine.MainMenu has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4490f888 that was originally added here 04-11 14:33:53.358: ERROR/WindowManager(4831): at android.view.ViewRoot.init(ViewRoot.java:247) Why it is working in portrait mode and not when i'm in landscape mode? what is wrong here? 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] It is possible to lock the screen orientation of the phone only when you want? (dinamically)
I have an application that can be viewed with landscape and portrait mode. I'm not using onConfigurationChanged() and android:configChanges=orientation|keyboardHidden and the screen orientation change is working perfectly. But now, i have a small problem. I want to learn to lock the screen orientation change of the screen. I mean that for example, when the user press a lock button, the screen orientation must be locked and it must not change, and when the user press again that button, the screen orientation must get unlocked ¿how can i lock the screen orientation dinamically? -- 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 use Archos 80 G9 to develop with Eclipse? Eclipse doesn't detect it.
Hi I received an Archos 80 G9 and i need to use it to develop with eclipse. I follow these instructions: http://www.archos.com/support/support_tech/updates_adb.html?country=wslang=en I added *0x0e79 *to the ini file* *and also i have installed the goolge usb drivers, because before this i was developing with google nexus one and google official usb driver, so it is installed. But eclipse didn't detect Archos when it is pluged in. Windows 7 is detecting it as a Massive Storage device ¿how can i solve this? thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to serialize a Class that includes a Bitmap?
Hi I have a simple class that implements Serializable, because i'm serializating the class storing it on the sdcard into a file. The class haves a Bitmap inside, and the bitmap is not bening Serialized because when i recover the class from the sdcard binary file the bitmap is NULL How can solve this? i can't find info on google. 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] How to store a JPG remote file into the phone internalMemory/sdcard?
I need to add a new functionality into my app. I must store a lot of JPG images from internet into the Phone. If the phone haves sdcard, the JPG files must be stored on the sdcard. If not, they must be stored on the internalMemory, only if the phone haves space to do it. Then, i should do these things: 1. Check if the Phone haves SDCARD. If haves, SDCARD dir is the destiny, if not, INTERNAL MEMORY is the destiny. 2. Check if the phone have space to store the photos. 3. If have space, store the photos into a dir called `/Magazine/` I know how to get a JPG file from internet and how to transform it into BITMAP, but it is the only think i know, i dont know how to store it as JPG and i dont know the other things. public static Bitmap getRemoteBitmap(String url) { Bitmap bm=null; HttpClient httpclient = new DefaultHttpClient(); HttpResponse response; try { ((AbstractHttpClient) httpclient).getCredentialsProvider().setCredentials( new org.apache.http.auth.AuthScope(null,-1), new org.apache.http.auth.UsernamePasswordCredentials(MagazineStatus._username, MagazineStatus._password)); response = httpclient.execute(new HttpGet(url)); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK) { try { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); bm=BitmapFactory.decodeStream(content ); }catch(Exception ex) {Log.e(DBF Error,ex.toString());} }else { response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } }catch(ClientProtocolException cpe) {Log.e(ClientProtocolException @ at FPT,cpe.toString());} catch(Exception ex) {Log.e(Exception at FETCHPROJECTASK,ex.toString());} return bm; } I'm searching in google how to do the things i need, but i can't find any clear information, i prefeer to ask you for the best way to do this, the optimal way. 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] Very easy to solve problem with SimpleXML. What i'm doing wrong?
i'm working with Android and SimpleXML I need to parse this XML file with SimpleXML: magazine title=Número 1 id=1 descriptionyutyutyu/description miniaturehttp://web.com/scripts/getImage.php?idMagazine=1resource=miniature.jpg/miniature summary2/summary pages page src=http://web.com/scripts/getImage.php?idMagazine=1resource=page_001.jpg; id=1 thumbnail=http://web.com/scripts/getImage.php?idMagazine=1resource=thumbnail_001.jpg; areas area id=1 top188/top left204/left width399/width height319/height action type=openBrowserhttp://www.web.com/action /area area id=2 top188/top left204/left width399/width height319/height action type=openBrowserhttp://www.web.com/action /area /areas /page page src=http://web.com/scripts/getImage.php?idMagazine=1resource=page_002.jpg; id=2 thumbnail=web.com/scripts/getImage.php?idMagazine=1resource=thumbnail_002.jpg/ page src=http://web.com/scripts/getImage.php?idMagazine=1resource=page_003.jpg; id=3 thumbnail=web.com/scripts/getImage.php?idMagazine=1resource=thumbnail_003.jpg/ /pages /magazine I'm getting this exception: 03-22 16:02:35.072: WARN/System.err(1931): org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=false, name=, required=true, type=void) on field 'areas' public java.util.ArrayList com.Magazine.Page.areas for class com.Magazine.Page at line 1 These are my java clases... ¿what is wrong? @Root (name=magazine) public class FullMagazine { @Attribute String title; @Attribute String id; @Element String description; @Element String miniature; @Element int summary; @ElementList public ArrayListPage pages; public String getTitle() { return title; } public String getId() { return id; } public String getDescription() { return description; } public Bitmap getMiniature() { return Util.getRemoteBitmap(miniature); } public static FullMagazine Load(String xml){ Serializer serializer = new Persister(); try{ return serializer.read(FullMagazine.class, xml); }catch (Exception e) {e.printStackTrace();} return null; //si llega aquí es que ha fallado. } } @Root public class Page { @Attribute String src; @Attribute String id; @Attribute String thumbnail; @ElementList public ArrayListArea areas; } @Root public class Area { @Attribute String id; @Element int top; @Element int left; @Element int width; @Element int height; @Element Action action; } @Root public class Action { @Attribute String type; String action; } -- 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] Small issue with SimpleXML. Why i'm getting this exception?
I'm getting this exception when i'm parsing with Simple XML: 03-20 12:43:38.163: WARN/System.err(1886): org.simpleframework.xml.core.ElementException: Element 'Magazine' does not have a match in class com.Magazine.Magazines at line 1 This is the XML file: Magazines Magazine title=APP 1 id=1 descriptionPrueba real/description miniaturehttp://web/miniature.jpg/miniature /Magazine Magazine title=APP 2 id=2 descriptionPrueba real 2/description miniaturehttp://web/miniature2.jpg/miniature /Magazine Magazine title=APP 3 id=3 descriptionPrueba real 3/description miniaturehttp://web/miniature3.jpg/miniature /Magazine /Magazines And these are my Java classes for Simple XML: public class Magazine { @Attribute String title; @Attribute String id; @Element String description; @Element String miniature; Bitmap miniatureBitmap; public String getTitle() { return title; } public String getId() { return id; } public String getDescription() { return description; } public Bitmap getMiniature() { return Util.getRemoteBitmap(miniature); } } Another class: @Root public class Magazines{ @ElementList(name=Magazine, inline=true) public ArrayListMagazine previews; public static Magazines Load(String xml){ Serializer serializer = new Persister(); try{ return serializer.read(Magazines.class, xml); }catch (Exception e) {e.printStackTrace();} return null; //si llega aquí es que ha fallado. } } -- 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] Wich is the easiest approach to get interpret a XML file response from a PHP script?
I need to add a simple functionality into my Android app. I must connect to this fictional script: http://test/getMagazinesList.php The script will return me a XML file like this: magazines magazine title=APP 1 id=1 descriptionPrueba real/description miniaturehttp://web/miniature.jpg/miniature /magazine magazine title=APP 2 id=2 descriptionPrueba real 2/description miniaturehttp://web/miniature2.jpg/miniature /magazine magazine title=APP 3 id=3 descriptionPrueba real 3/description miniaturehttp://web/miniature3.jpg/miniature /magazine /magazines The objective is to store all the info of the XML in a List of these MagazinePreview objects: public class MagazinePreview { String title; String id; String description; String miniatureUrl; Bitmap miniature; public MagazinePreview(String title, String id, String description, String miniatureUrl) { super(); this.title = title; this.id = id; this.description = description; this.miniatureUrl = miniatureUrl; } } Wich is the easiest approach to connect to that PHP and get the XML and interpret it storing the info on the List of MagazinePreview class objects? 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] How to launch OnTouchListener on the elements of a ScrollView but only when the user is not Scrolling?
i have a huge problem managing my horizontal scrollview. It haves inside a horizontal linear layout with a lot of vertical linear layouts wich haves a text and a image. I want that when the user press on the vertical linearlayouts, the ontouchlistener must be called launching a new feature of my app. The problem is that when the user scrolls the scrollview, the ontouchlistener of the verticallinearlayouts is being called, and i dont want that. How can this be solved? Thanks My code: final HorizontalScrollView hsv = new HorizontalScrollView(this); RelativeLayout.LayoutParams hsvParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); hsvParams.addRule(RelativeLayout.BELOW,6); hsv.setBackgroundColor(0x55383838); hsv.setLayoutParams(hsvParams); hsv.setVisibility(View.GONE); //inicialmente está oculto LinearLayout hsvll = new LinearLayout(this); hsvll.setOrientation(LinearLayout.HORIZONTAL); hsvll.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); hsvll.setPadding(0, 0, 0, 5); createThumbnails(); List LinearLayout thumbnailLinearLayouts = new ArrayListLinearLayout(); for (int i=1; i=squareGLSurfaceView.pages.size();i++){ //el tope es =pages.size() porque hay que recordar que se ha añadido una página en blanco al principio, por lo que la última página será = .size(). Nos guiamos por pages.size en lugar de thumbnails.size() porque thumbnails.size() puede haber crecido para añadir una página en blanco al final, que no queremos mostrar LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); ll.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); ll.setPadding(10, 0, 10, 0); thumbnailLinearLayouts.add(ll); TextView tv = new TextView(this); tv.setText(+(i)); tv.setGravity(Gravity.RIGHT); ll.addView(tv); ImageView iv = new ImageView(this); iv.setImageBitmap(thumbnails.get(i)); ll.addView(iv); hsvll.addView(ll); } hsv.addView(hsvll); rl.addView(hsv); for (int i=0;ithumbnailLinearLayouts.size();i++){ final int auxIndex=i; thumbnailLinearLayouts.get(i).setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { MagazineStatus.currentPage=auxIndex; hsv.setVisibility(View.GONE); return true;} }); } -- 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] Wich is the best way to destroy a GLSurfaceview and free all the memory?
I have a GLSurfaceView with four polygons with textures. I need to destroy the GLSurfaceview and recreate a new GLSurfaceView with new parameters when the user press a button. I tryed with myGLSurfaceView = null and initializing again myGLSurfaceView with the new paramters, but it is giving me VM budget bitmnap exception. I dont understand why, because i am doing recicle() on all the bitmaps i use. So, i think that i need to destroy all the polygons of my glsurfaceview and my glsurfaceview before tho recreating a new glsurfaceview. Wich is the correct way to achieve this? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to display a LinearLayout menu aligned to the right of a FrameLayout and 100px below the top of the screen?
I have a FrameLayout (all the screen is the FL) wich haves a openGLview and a header image on the top of the screen. Now i want to display a menu of two buttons, created with a LinearLayout. My LL Menu must be floating on the framelayout, aligned to the right of the screen and must be 100px below the top of the screen. How can i achieve that? i tryed with this code, but is not working, the Menu is being displayed on the left on the screen and it is painting the upper part of the menu, and i dont want that, i need that the upper part of the menu it's not painted with the colour of the menu. Must be a floating menu. ///sub menu de shareit LinearLayout sharell = new LinearLayout(this); sharell.setOrientation(LinearLayout.VERTICAL); sharell.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); sharell.setGravity(Gravity.RIGHT); sharell.setPadding(10, 100, 10, 10); sharell.setBackgroundColor(0xFF383838); share= new ImageButton(this); selector(share, R.drawable.but_share_up,R.drawable.but_share_down); LinearLayout.LayoutParams shareParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); shareParams.setMargins(0, 0, 0, 10); //dejo un espacio entre este botón y el siguiente share.setLayoutParams(shareParams); sharell.addView(share); web= new ImageButton(this); selector(web, R.drawable.but_web_up,R.drawable.but_web_down); sharell.addView(web); // . . . fl.addView(squareGLSurfaceView); fl.addView(rl); fl.addView(sharell); setContentView(fl); -- 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 load a bitmap texture in a thread on a polygon class?
i'm developing a simple OpenGL ES 1.1 app for android. I have a GLSurfaceView class that uses a square class that represent's a square polygon wich is rotating and must change his texture when the user press a button. I need to load the bitmap texture on a thread because i dont want to stop the rotation of the polygon. I'm having problems with this, the texture is not changing, instead of that i'm getting white textures. THis is the code of my square polygon, with the thread on the end of the code. The method loadBitmap() is the method that changes the texture and launches the thread. public class Square { //Buffer de vertices public FloatBuffer vertexBuffer; //Buffer de coordenadas de texturas private FloatBuffer textureBuffer; //Puntero de texturas private int[] textures = new int[3]; //El item a representar public Bitmap bitmap; //image with POT dimensions //size of the polygon: public float w; public float h; //size of the texture private float textureX; private float textureY; //Definición de vertices public float vertices[] = new float[12]; private float vertices_transformed[] = new float[12]; //Coordenadas (u, v) de las texturas private float texture[]; // Image ratio float ratio; Context context; boolean textureChanged=false; int newTexture=-1; public int nextPOT; private boolean loadingTexture=false; //true si está cargando la textura int bitmapW; int bitmapH; loadBitmapThread lbt; int textureName = -1; //Inicializamos los buffers public Square(Bitmap image, Context context) { initSquare(image); ByteBuffer byteBuf = ByteBuffer.allocateDirect(vertices.length * 4); byteBuf.order(ByteOrder.nativeOrder()); vertexBuffer = byteBuf.asFloatBuffer(); vertexBuffer.put(vertices); vertexBuffer.position(0); byteBuf = ByteBuffer.allocateDirect(texture.length * 4); byteBuf.order(ByteOrder.nativeOrder()); textureBuffer = byteBuf.asFloatBuffer(); textureBuffer.put(texture); textureBuffer.position(0); //setPosition(0,0); ratio = (float)image.getWidth() / image.getHeight(); image.recycle(); } public void initSquare(Bitmap image) { //inicializo los arrays de texturas y vertices con las proporciones correctas de la imagen y creo la variable bitmap con potencia de 2. bitmapW=image.getWidth(); bitmapH=image.getHeight(); w=1.00f; h=(float)bitmapH/bitmapW; float vertices2[] = { -w, -h, 0.0f, //Bottom Left w, -h, 0.0f,//Bottom Right -w, h, 0.0f,//Top Left w, h, 0.0f //Top Right }; vertices=vertices2; //calculamos la siguiente potencia de 2 del lado mas largo del bitmap, alto o ancho. if (bitmapWbitmapH) nextPOT=getNextPOT(bitmapW); else nextPOT=getNextPOT(bitmapH); //creamos un nuevo bitmap cuadrado con dimensiones potencia de 2, y dentro de el metemos la imagen //bitmap = Bitmap.createBitmap(nextPOT, nextPOT, Bitmap.Config.ARGB_); //crea un bitmap transparente gracias al ARGB_ bitmap = Bitmap.createBitmap(nextPOT, nextPOT, Bitmap.Config.RGB_565); //crea un bitmap transparente gracias al ARGB_ Canvas comboImage = new Canvas(bitmap); comboImage.drawBitmap(image, 0, 0, null); comboImage.save(); //calculamos las coordenadas de la textura dentro del bitmap que es potencia de 2 textureX = (float)bitmapW / nextPOT; textureY = (float)bitmapH / nextPOT; //creamos el array de la textura, pasándole las coordenadas ya obtenidos float texture2[] ={ 0.0f,textureY, textureX, textureY, 0.0f, 0.0f, textureX,0.0f }; System.out.println(bw:+bitmapW+ nextPOT:+nextPOT+ texX:+textureX); texture=texture2; } //Funcion de dibujado public void draw(GL10 gl) { if (loadingTexture==false){ GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); mCropWorkspace[0] = 0; mCropWorkspace[1] = bitmap.getHeight(); mCropWorkspace[2] = bitmap.getWidth(); mCropWorkspace[3] = -bitmap.getHeight(); //bitmap.recycle(); ((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0); //textures[0]=textureName; newTexture=textureName; gl.glFrontFace(GL10.GL_CCW); //gl.glEnable(GL10.GL_BLEND); //Bind our only previously generated texture in this case if (textureChanged==false) gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); else //textureChanged==true gl.glBindTexture(GL10.GL_TEXTURE_2D, newTexture); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Set The Color To Blue //gl.glColor4f(0.5f, 0.5f, 1.0f,
[android-developers] How to progressively make invisible a polygon?
I need to make progressively invisible a polygon with OpenGL ES 1.1. I'm developing for Android, but i think that other platforms will do the same code with some minor changes. How i can do that? i can't find any info on google or stackoverflow. Any help and tutorials will be apreciated. Thanks a lot -- 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 can i make my texture (or polygon) transparent when i want? (opengl es 1.1)
How can i do that? El viernes 2 de marzo de 2012 07:44:42 UTC+1, Yan escribió: Using the alpha values would add a huge layer of complexity to your program. Perhaps instead you may consider having a switch in your code to throw those polygons in your color buffer rather than your texture buffer... On Thursday, March 1, 2012 9:53:44 AM UTC-7, saex wrote: I have a square polygon with a texture (opengl es 1.1), and i need that when i want the polygon get's invisible and when i want the polygon turn's visible again. It's frustrating because seems to be a very easy thing but i can't find any tutorials or examples for do it on google or stackoverflow. please, can someone give me a sample to do it? 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] How can i make my texture (or polygon) transparent when i want? (opengl es 1.1)
I have a square polygon with a texture (opengl es 1.1), and i need that when i want the polygon get's invisible and when i want the polygon turn's visible again. It's frustrating because seems to be a very easy thing but i can't find any tutorials or examples for do it on google or stackoverflow. please, can someone give me a sample to do it? 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] Problems changing the texture of a polygon in a thread… white textures
In some point of my app i need to changue the texture of a polygon. For that, i must load a bitmap from assets folder and then i pass the bitmap to a loadBitmap method of my polygon that changes the texture. It is working fine, but i need to move the code into a thread, because the loading time of the bitmap it's frozing my opengl polygon when it's loading the bitmap from assets folder. Because that i implemented a thread that it is called to change the texture, but something is going wrong because my texture is empty (white) when i use the thread, but it works if i dont use the thread, this is my thread code: public class addNextPage extends Thread { GL10 gl; public addNextPage(GL10 gl) { super(); this.gl = gl; } public void run() { super.run(); Bitmap bm=loadImage(pages.get(0)); auxSquare.loadBitmap(context, gl, bm); squares.set(3,auxSquare); currentPage+=1; //vuelvo a recolocar los squares int posCont=-2; //el primer polígono está a la izquierda, no se ve. for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).setPosition(posCont,0); posCont+=2; } } } -- 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] Wich is the correct way to change the texture of a polygon?
I need a little help to achive something with OpenGL ES 1.1 I have a symple square polygon (from nehe tutorials) with a texture. The polygon haves a bitmap and the method loadGLTexture(GL10 gl, Context context) is called once, when the polygon is created, to load the texture. I need to add the functionality to my app to change the texture of the square. Wich is the best way to change the texture of a polygon? can't find the right way on google... thanks all -- 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 changue the texture of a polygon efficiently?
I have a symple square polygon (from nehe tutorials) with a texture. The polygon haves a bitmap and the method loadGLTexture(GL10 gl, Context context) is called once, when the polygon is created, to load the texture. I need to add the functionality to my app to change the texture of the square. Wich is the best way to change the texture of a polygon? can't find the right way on google... 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] How to check when the phone changues from portrait to landscape? (with portrait mode forced in manifest)
I have a special need for my app. I must force the app to work only in portrait mode, but i need to know when the user has moved the phone to landscape mode. Why? because i am displaying a opengl view with a texture image, and when the user changues the phone position to landscape mode i must rotate the polygon without reseting the activity. Then i must force portrait mode on manifest, because i dont want that my onCreate method gets called again. Please, can someone tell me how to achieve this? I know how to rotate the image, i only need to know when the user has moved the phone to landscape position, but with portrait forced on manifest. 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] How to create a polygon with the dimensions of a texture?
i'm trying to develop a simple opengl ES 1.1 app that must show a square polygon with a texture. The texture haves a rectangular resolution of 1536x2048 pixels. I'm learning opengl with the NEHE tutorials, but they didn't eplain how to create a polygon with the dimensions of the textures. This is my actual square.java code, it is doing it by the wrong way. It receives a bitmap as parameter, and it creates a new scaled bitmap with square form with POT dimensions, but with square proportions, this code uses a square polygon, and i dont need that. what i need to modify to create this polygon with the dimensions of the texture? public class Square { //Buffer de vertices private FloatBuffer vertexBuffer; //Buffer de coordenadas de texturas private FloatBuffer textureBuffer; //Puntero de texturas private int[] textures = new int[3]; //El item a representar private Bitmap image; //Definición de vertices private float vertices[] = { -1.0f, -1.0f, 0.0f, //Bottom Left 1.0f, -1.0f, 0.0f, //Bottom Right -1.0f, 1.0f, 0.0f, //Top Left 1.0f, 1.0f, 0.0f//Top Right }; private float texture[] = { //Mapping coordinates for the vertices 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f }; // Image ratio float ratio; //Inicializamos los buffers public Square(Bitmap image) { ByteBuffer byteBuf = ByteBuffer.allocateDirect(vertices.length * 4); byteBuf.order(ByteOrder.nativeOrder()); vertexBuffer = byteBuf.asFloatBuffer(); vertexBuffer.put(vertices); vertexBuffer.position(0); byteBuf = ByteBuffer.allocateDirect(texture.length * 4); byteBuf.order(ByteOrder.nativeOrder()); textureBuffer = byteBuf.asFloatBuffer(); textureBuffer.put(texture); textureBuffer.position(0); this.image=image; ratio = (float)image.getWidth() / image.getHeight(); } //Funcion de dibujado public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CCW); //gl.glEnable(GL10.GL_BLEND); //Bind our only previously generated texture in this case gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //gl.glDisable(GL10.GL_BLEND); } //Carga de texturas public void loadGLTexture(GL10 gl, Context context) { //Generamos un puntero de texturas gl.glGenTextures(1, textures, 0); //y se lo asignamos a nuestro array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Creamos filtros de texturas gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); //Diferentes parametros de textura posibles GL10.GL_CLAMP_TO_EDGE gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); //Get the texture from the Android resource directory InputStream is=null; Bitmap bitmap =image; //con el siguiente código redimensionamos las imágenes que sean mas grandes de 256x256. int newW=bitmap.getWidth(); int newH=bitmap.getHeight(); float fact; if (newH256 || newW256) { if (newH256) { fact=(float)255/(float)newH; //porcentaje por el que multiplicar para ser tamaño 256 newH=(int)(newH*fact); //altura reducida al porcentaje necesario newW=(int)(newW*fact); //anchura reducida al porcentaje necesario } if (newW256) { fact=(float)255/(float)newW; //porcentaje por el que multiplicar para ser tamaño 256 newH=(int)(newH*fact); //altura reducida al porcentaje necesario newW=(int)(newW*fact); //anchura reducida al porcentaje necesario } bitmap=Bitmap.createScaledBitmap(bitmap, newW, newH, true); } //con el siguiente código transformamos imágenes no potencia de 2 en imágenes potencia de 2 (pot) //meto el bitmap NOPOT en un bitmap POT para que no aparezcan texturas blancas. int nextPot=256; int h = bitmap.getHeight();
[android-developers] Problems with MatrixGrabber: java.lang.ClassCastException: com.google.android.gles_jni.GLImpl
I have a GLSurfaceView class that must show a square with a texture. I'm trying to fit the screen with the texture/polygon dimensions, then i need to use projections. I'm using 3 classes to have compatibility with android 1.5: MatrixGrabber.java MatrixStack.java MatrixTrackingGL.java This is the part of the code that it is giving the error: private MatrixGrabber mg = new MatrixGrabber(); //create the matrix grabber object in your initialization code . . . DisplayMetrics dm = new DisplayMetrics(); ((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(dm); screenW=dm.widthPixels; screenH=dm.heightPixels; modelMatrix=mg.mModelView; projMatrix=mg.mProjection; mView[0] = 0; mView[1] = 0; mView[2] = screenW; //width mView[3] = screenH; //height . . . public void onDrawFrame(GL10 gl) { //Clear Screen And Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity();//Reset The Current Modelview Matrix mg.getCurrentProjection(gl); mg.getCurrentModelView(gl); . . . And this is the error: 02-17 09:13:59.952: WARN/dalvikvm(11405): threadid=8: thread exiting with uncaught exception (group=0x4001d7e0) 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): FATAL EXCEPTION: GLThread 9 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): java.lang.ClassCastException: com.google.android.gles_jni.GLImpl 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at com.DemoMagazine.MatrixGrabber.getMatrix(MatrixGrabber.java:56) 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at com.DemoMagazine.MatrixGrabber.getCurrentProjection(MatrixGrabber.java: 52) 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at com.DemoMagazine.SquareGLSurfaceView.onDrawFrame(SquareGLSurfaceView.java: 112) 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java: 1332) 02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116) -- 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] Why all the content of my GL10 gl object is null?
I'm trying to create a simple opengl test. i have a GLSurfaceView class that must show a square with a texture. I'm trying to fit the screen with the texture/polygon dimensions, then i need to use projections. I'm using 3 classes to have compatibility with android 1.5: MatrixGrabber.java MatrixStack.java MatrixTrackingGL.java The problem is that i am getting an exception because all the content of my GL10 gl object is null, then, when i try to get the projection or the model matrix i got exception. THis is the code: public class SquareGLSurfaceView extends GLSurfaceView implements Renderer { private Square square; private final float Z = -1.0f; //eje Z private float x = 0;//eje X private float y = 0;//eje Y private float oldX; private float oldY; private final float TOUCH_SCALE = 0.2f; //Proved to be good for normal rotation ( NEW ) private static Context context; //los siguientes valores son para hacer proyecciones gluProject para mover el objeto con el dedo float screen2GL = 0f; float [] modelMatrix = new float[16]; float [] projMatrix = new float[16]; float [] outputCoords= new float[4]; int [] mView = new int[4]; private float scale=0.01f; // Translations float offset_x , offset_y; private MatrixGrabber mg = new MatrixGrabber(); //create the matrix grabber object in your initialization code int screenW; //screen Width int screenH; //screen Height public SquareGLSurfaceView(Context context) { super(context); this.setRenderer(this); this.requestFocus(); this.setFocusableInTouchMode(true); this.context = context; Bitmap bm=loadImage(sample_0); square = new Square(bm); DisplayMetrics dm = new DisplayMetrics(); ((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(dm); screenW=dm.widthPixels; screenH=dm.heightPixels; modelMatrix=mg.mModelView; projMatrix=mg.mProjection; mView[0] = 0; mView[1] = 0; mView[2] = screenW; //width mView[3] = screenH; //height } public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); //dithering OFF gl.glEnable(GL10.GL_TEXTURE_2D);//Texture Mapping ON gl.glShadeModel(GL10.GL_SMOOTH);//Smooth Shading gl.glClearDepthf(1.0f); //Depth Buffer Setup gl.glEnable(GL10.GL_DEPTH_TEST);//Depth Testing ON gl.glDepthFunc(GL10.GL_LEQUAL); gl.glClearColor(0,0,0,0); //fondo transparente gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Cargamos la textura del cubo. square.loadGLTexture(gl, this.context); } public void onDrawFrame(GL10 gl) { //Clear Screen And Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity();//Reset The Current Modelview Matrix mg.getCurrentProjection(gl); mg.getCurrentModelView(gl); // Translating if( offset_x != 0 ){ x+=offset_x * screen2GL; offset_x = 0; } if( offset_y != 0 ){ y+=offset_y * screen2GL; offset_y = 0; } gl.glTranslatef(x, y, Z ); //Move z units into the screen Log.d(onDrawFrame,x:+x+ y:+y+ z:+Z); //Drawing gl.glScalef(scale, scale, 1.0f); square.draw(gl);//Draw the Cube } public void onSurfaceChanged(GL10 gl, int width, int height) { if(height == 0) { //Prevent A Divide By Zero By height = 1; //Making Height Equal One } gl.glViewport(0, 0, width, height); //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION);//Select The Projection Matrix gl.glLoadIdentity();//Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix gl.glLoadIdentity();//Reset The Modelview Matrix solveScreen2GL(); } public boolean onTouchEvent(MotionEvent event) { float screenX = event.getX(); float screenY = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: break; case MotionEvent.ACTION_MOVE: offset_x+=screenX - oldX; offset_y-=screenY - oldY; break; } oldX=event.getX();
[android-developers] It is possible to embed a MapActivity into another Activity without using Fragments?
Hi It is possible to embed a MapActivity into another Activity without using Fragments??? How can i achieve it? 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] Exist's someting like execSQL() but for select sentences?
I like execSQL because i can do this: db.execSQL(INSERT INTO Usuarios (codigo, nombre) VALUES (1, 'pedro')); exist's something similar (wich only needs a string as parameter) but to do SELECT sentences and returns a Cursor with the results 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] Problems with the width of the bitmap. The width is limited by the height of the screen
Hi I'm creating a bitmap wich i need to use as background of a 320 width screen. The problem is that the bitmap is not getting the width i want. It is getting two empty spaces on the left and on the right. It is because it is fitting the height of the screen, but i dont want that, i want to force the bitmap to have the width i want. Doesn't matter if a portion of the height of the bitmap is out of the screen. i need to force the width when i am adding the image to the layout, i mean that the image must be keep the aspect ratio, but the image must be higher than the height of the screen, and the image must be shown incomplete if the heigh of the image is higher than the height of the screen. Now this is not happening, because the layout is forcing the width to respect the image and show all the height of the image in the height of the screen, then i think the problem is on the layout rules im creating the bitmap with: View view; Bitmap aux = Util.loadImage( filename ); //image loaded but with his original width Bitmap image = Util.scaleBitmap(aux, 320); //scaling to 320 ((ImageView)view).setImageBitmap( resource.image ); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams( 320 , h ); rlp.addRule( RelativeLayout.CENTER_HORIZONTAL ); rlp.addRule( RelativeLayout.ALIGN_PARENT_TOP ); layout.addView( view , rlp ); What am i doing wrong? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to create a binary file stored on the cache of the app and delete it after the use?
i have a android app that gets a binary file from a php script. I need to store the binary file returned by the remote php script into a binary file on the cache mem of the app. And after i use the binary file, i need to remove it. How can i achieve it? 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] All the google accounts of all the phones waiting for C2DM push notifications must be registered on C2DM?
i'm checking this link: http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html It says that in order tu ouse C2DM, you need to ask for access, because it is a beta software. Here is the link to the signup form: http://code.google.com/android/c2dm/signup.html OK, but wich account must ask for acces? the googleacount used in the server side? or all the millions of googleaccounts used on the millions of android phones that will receive notifications from the server? 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: All the google accounts of all the phones waiting for C2DM push notifications must be registered on C2DM?
the googleaccount used to register on that link, is the google acount that i must use on the server? or not? i didn't understand it On 12 ene, 13:46, appel johan.appelg...@gmail.com wrote: The developers that wants to use c2dm in their apps. -- 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] A BroadcastReceiver can start my own app? (with my app not started)
i want that when the phone receives a push notification from AC2M, a notification must be shown in the notification bar, and if the user press on the notification, my app must be started and show a specific activity describing that notification, and not the normal fist activity of my app. It is possible to achieve this? can someone explain me how? My app must be started to listen the receiver? or can my app be not started? 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