[android-developers] Re: Strange behaviour with mediaplayer and seekTo (on start-up)
Did you solved this issue? On Wednesday, 16 June 2010 10:23:49 UTC+5:30, Mathias Lin wrote: > > I'm implementing a custom video player because I need custom video > controls. I have an app with only one activity, which on start-up > shall starts playing a video right away. > > Now, the problem I have (on my Nexus One): > > I don't want the video to start from the beginning, but from a later > position. Therefore I do a seekTo(16867). Since seekTo is > asynchronous, I place the start call of the mediaplayer > (player.start()) in the onSeekComplete of the onSeekCompleteListener. > > **The strange behaviour I experience though is that I can see/hear the > video playing from the beginning for a few millisecs before it > actually plays from/jumps to the position I seeked to. > But - on the other hand - the Log output I call before the > player.start returns the correct position 16867, where I seeked to.** > > Below is the relevant code section, the complete class is at > http://pastebin.com/jqAAFsuX > > > private void playVideo(String url) { > try { > btnVideoPause.setEnabled(false); > if (player==null) { > player=new MediaPlayer(); > player.setScreenOnWhilePlaying(true); > } > else { > player.stop(); > player.reset(); > } > url = "/sdcard/myapp/main/videos/main.mp4"; // <--- just > for test purposes hardcoded here now > player.setDataSource(url); > player.setDisplay(holder); > player.setAudioStreamType(AudioManager.STREAM_MUSIC); > player.setOnCompletionListener(this); > player.setOnPreparedListener(this); > > player.setOnSeekCompleteListener(new > MediaPlayer.OnSeekCompleteListener() { > public void onSeekComplete(MediaPlayer mediaPlayer) { > Log.d("APP", "current pos... "+ > player.getCurrentPosition() ); > player.start(); // > <-- start playback on seek completed > player.setOnSeekCompleteListener(null); > } > }); > player.prepareAsync(); > } > catch (Throwable t) { > Log.e(TAG, "Exception in playVideo prep", t); > } > } > > public void onPrepared(MediaPlayer mediaplayer) { > width=player.getVideoWidth(); > height=player.getVideoHeight(); > if (width!=0 && height!=0) { > holder.setFixedSize(width, height); > progressBar.setProgress(0); > progressBar.setMax(player.getDuration()); > player.seekTo(16867); // <-- seeking > to position > } > btnVideoPause.setEnabled(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 --- 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: Different layout for Different screen sizes.
I doubt the density of the device you are playing with. I would suggest you to check the density of the device by using: DisplayMetrics dm = context.getResources().getDisplayMetrics();int densityDpi = dm.densityDpi; Check for more info: http://stackoverflow.com/questions/3166501/getting-the-screen-density-programmatically-in-android On Wednesday, 23 January 2013 11:51:14 UTC+5:30, sree wrote: > > Hi, > i am implementing UI design for samsung S3 and nexus S.when i am run my > project compatability of screen is change. > i am using separate layout in res folder like layout-sw240dp(Nexus S), > layout-sw320dp(S3).when i am running these both devices are take > layout-sw320dp xml file. > > can help any one for these problem. > thank you in advance > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android - How do we make notification visible once application is installed?
Hi, As per my this question, i have written the below code to show notification and also made a notification steady at the notification bar. private void showNotification() { CharSequence title = "Hello"; CharSequence message = "Notification Demo"; NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, "A Notification", System.currentTimeMillis()); Intent notificationIntent = new Intent(this, Main_Activity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(Main_Activity.this, title, message, pendingIntent); notification.flags = Notification.FLAG_NO_CLEAR; notificationManager.notify(NOTIFICATION_ID, notification); } But, is there any way to make a notification visible once the application is installed in the phone? I think there should be any scenario/method/file in which we can write this code and notification will be visible as soon as the application gets installed in the phone. Again i am taking an example of "yahoo mail" application, in the same application, once we installed the yahoo application, the notification is appeared with icon at the same time. Please share your ideas and suggestions. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android - How do we make notification visible once application is installed?
Hi, As per my this question, i have written the below code to show notification and also made a notification steady at the notification bar. private void showNotification() { CharSequence title = "Hello"; CharSequence message = "Notification Demo"; NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, "A Notification", System.currentTimeMillis()); Intent notificationIntent = new Intent(this, Main_Activity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(Main_Activity.this, title, message, pendingIntent); notification.flags = Notification.FLAG_NO_CLEAR; notificationManager.notify(NOTIFICATION_ID, notification); } But, is there any way to make a notification visible once the application is installed in the phone? I think there should be any scenario/method/file in which we can write this code and notification will be visible as soon as the application gets installed in the phone. Again i am taking an example of "yahoo mail" application, in the same application, once we installed the yahoo application, the notification is appeared with icon at the same time. Please share your ideas and suggestions. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: pdf reader
If i m not having third party pdf application installed in the android device then? ?? On 29 Dec 2010 13:26, "Robin Talwar" wrote: This is my onclick code public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.setDataAndType(Uri.parse("file:///raw/unlockingandroid.pdg"), "application/pdf"); try{ startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(pdfviewer.this, "No Application Available to View PDF", Toast.LENGTH_SHORT).show(); } } I see a toast when i click the button :( i cant see the pdf On Wed, Dec 29, 2010 at 12:26 PM, Jake Basile wrote: > > Just like opening... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, 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: Display Calendar Instance
Thanx for the support, but can you let me know where i found the Android source for the Calendar instance pls pls let me know On Nov 23, 9:38 pm, TreKing wrote: > On Mon, Nov 22, 2010 at 5:47 AM, paresh mayani wrote: > > > what i should do to display the same dialog box or Calendar instance in my > > application ?? > > Look through the Android source and see if that version of the date picker > is still in there somewhere, yank it out, and add it to your project. > > - > 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] Display Calendar Instance
Hello all, i have referred the example given on: http://goo.gl/1uxXv , But it is not showing the exact DatePicker dialog as given in the book example, what i should do to display the same dialog box or Calendar instance in my application ?? pls Help me -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android calendar control
Hello, I have referred the article (at http://www.developer.com/article.php/3850276 ) for implementing the native calendar control, but i would like to display calendar also on the screen and also User can able to select date, and after selecting date user can also be able to event on that selected date. So is there any way to display calendar (month view) in Android ?? pls help me -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Rapidly load data on Re-launch of an Activity
Thanx for the support and sorry for the late reply, Actually, data is going to be changed frequently, so i am also confused that what should i implement actually i.e. whether File or Database ?? On Nov 12, 8:05 pm, Kumar Bibek wrote: > Of course, save your results to a local database. That will be > considerably faster. > > On Nov 12, 6:05 pm, paresh mayani wrote: > > > Hello all, > > > Actually, i am fetching XML from the web, parsing it and display it on > > the screen. The problem which i am getting is that the activity tries > > to load the data from web each time the activity is called.(Actually, > > my mobile app requires frequent trips to the server) So i am in search > > of the below solution: > > > On Re-launch of an activity, the data from web should not be loaded > > again. (But it should load data from the cache or local database that > > we have created while calling the web-xml for the first time). > > creating a class that i can use to transparently make application > > faster by > > selectively caching items in memory. And thus, making users very > > happy and > > This class can even apply individual refresh times to each cached > > item. > > > So, i think i need to store the data in Cache , or in local database > > or something like that. > > > Is there any way/technique to implement such thing ? so that it need > > not to load from web every-time on Re-launch of an activity. > > > [Note: I want to do to make client happy by decreasing the loading > > time and running the application efficiently and optimizing > > application's loading time] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Rapidly load data on Re-launch of an Activity
thanx Kostya for the support and sorry for late reply, Actually, data is going to be changed frequently, and i am also confused that whether i should implement Database or File ?? pls show me a way to my problem as i have stated above (data is going to be changed frequently). On Nov 12, 8:27 pm, Kostya Vasilyev wrote: > Paresh, > > There are a couple options, depending on how large the data is, how > quickly it changes, and how important it is to completely avoid > unnecessary reloads: > > 1 - Use SQLiteDatabase or SharedPreferences. > > This is truly persistent, and will survive the death/resurrection of not > just the Activity, but of the process as well, and even the phone being > rebooted. > > 2 - Keep an in-memory data structure (a Java singleton should work well). > > This will survive activity lifecycle, but will go away when the process > does. However, this may not happen immediately after the user leaves the > activity, so there is still value here. > > -- Kostya > > 12.11.2010 16:05, paresh mayani пишет: > > > > > Hello all, > > > Actually, i am fetching XML from the web, parsing it and display it on > > the screen. The problem which i am getting is that the activity tries > > to load the data from web each time the activity is called.(Actually, > > my mobile app requires frequent trips to the server) So i am in search > > of the below solution: > > > On Re-launch of an activity, the data from web should not be loaded > > again. (But it should load data from the cache or local database that > > we have created while calling the web-xml for the first time). > > creating a class that i can use to transparently make application > > faster by > > selectively caching items in memory. And thus, making users very > > happy and > > This class can even apply individual refresh times to each cached > > item. > > > So, i think i need to store the data in Cache , or in local database > > or something like that. > > > Is there any way/technique to implement such thing ? so that it need > > not to load from web every-time on Re-launch of an activity. > > > [Note: I want to do to make client happy by decreasing the loading > > time and running the application efficiently and optimizing > > application's loading time] > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Rapidly load data on Re-launch of an Activity
Hello all, Actually, i am fetching XML from the web, parsing it and display it on the screen. The problem which i am getting is that the activity tries to load the data from web each time the activity is called.(Actually, my mobile app requires frequent trips to the server) So i am in search of the below solution: On Re-launch of an activity, the data from web should not be loaded again. (But it should load data from the cache or local database that we have created while calling the web-xml for the first time). creating a class that i can use to transparently make application faster by selectively caching items in memory. And thus, making users very happy and This class can even apply individual refresh times to each cached item. So, i think i need to store the data in Cache , or in local database or something like that. Is there any way/technique to implement such thing ? so that it need not to load from web every-time on Re-launch of an activity. [Note: I want to do to make client happy by decreasing the loading time and running the application efficiently and optimizing application's loading time] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Wireless settings dialog
Hello, i am checking networking connection using the below code: public static boolean haveInternet(Context ctx) { NetworkInfo info = (NetworkInfo) ((ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo(); if (info == null || !info.isConnected()) { return false; // no connection } return true; // true if having connection } Now, on "no connection" , i am launching "Wireless settings" dialog using the below code: context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); but, user is being able to "on/off" the wireless, now how do i come to know whether the user has made "on" the wi-fi or not? what result is returned by the above intent on the successful wireless connection. how do i check 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] Android - Sliding Drawer to slide from Left-to-Right
Hello all, I am trying to implement "Sliding Drawer" in my application using the below xml layout: http://schemas.android.com/apk/res/android"; android:background="@drawable/androidpeople"> But Sliding drawer is sliding from Right-to-Left (Horizontal), but what if i want to make it slide from Left-to-Right (Horizontal) ?? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android - Large Application size (Memory) issue
Hello all, I am facing the "Memory" related issues and i am searching the possible solution to this issues since last 2 weeks. Right now i have developed an android application for the personal perpose, whose size is 54 MB, from which 52 MB of only Images/Photos. So i want to install it on Android SDK 2.2 for that i have already set android:installLocation="preferExternal" in the AndroidManifest.xml file. I have created 256MB sd-card while creating an avd , heap size - 192 , ram size - 192, cache-partition-size - 256MB but it still showing me an error: [2010-08-27 17:58:28 - demo_test] Failed to upload demo_test.apk on device 'emulator-5554' [2010-08-27 17:58:28 - demo_test] java.io.IOException: Unable to upload file: No space left on device [2010-08-27 17:58:28 - demo_test] Launch canceled! what issues i am facing ? pls give me suggestion or solution to these issues -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en