Sunday, June 30, 2013

[android help] how to set current time running continuesly with hours ,minutes ,seconds to textview in android?


how to set current time running continuesly with hours ,minutes ,seconds to textview in android?


how to set the current time running continuously with hours ,minutes ,seconds to textview in android? - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















Actually by the time my Activity starts i should display current time in hours ,minutes,seconds(HH:mm:ss) in 24 hours format, and this time should run continuously as seconds need to change continuously gradually minutes and hours also. I kept a stop button in activity. once stop is clicked the time should stop and that stopped time need to be saved in a string .





























Try like this.. onClick of STOP Button



String currentTimeString = new SimpleDateFormat("HH:mm:ss").format(new Date());


Use this string in Toast or TextView or whatever depending on your requirement


To get Watch like display refer here























Try this code..



Date date =new Date();
DateFormat format = SimpleDateFormat.getTimeInstance
( SimpleDateFormat.MEDIUM, Locale.getDefault());

// set the text of component TextView with id 'message'
textView.setTextViewText(R.id.widget_textview,"Current Time "+ format.format(date));



















default






.

stackoverflow.comm



[android help] How do I import android licensing into eclipse?


How do I import android licensing into eclipse?



I found a question about it:


After this I found out that the package called "Google Play Licensing Library" and not "Google Market..". I saw that its already installed.


I also find a guide that should explain how to add lvl like library project: http://developer.android.com/google/play/licensing/setting-up.html#download-lvl


But I could do it. I tried to look for the files in the extra directory also with no luck...


What should I do?



.

stackoverflow.comm



[android help] MediaPlayer(16454): Unable to to create media player


MediaPlayer(16454): Unable to to create media player


android - MediaPlayer(16454): Unable to to create media player - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I got this error:



06-28 09:32:24.266: E/MediaPlayer(16454): Unable to to create media player
06-28 09:32:24.338: W/VideoView(16454): Unable to open content: /data/data/com.laroche/cache/intro.mp4
06-28 09:32:24.338: W/VideoView(16454): java.io.IOException: setDataSourceFD failed.: status=0x80000000
06-28 09:32:24.338: W/VideoView(16454): at android.media.MediaPlayer.setDataSource(Native Method)
06-28 09:32:24.338: W/VideoView(16454): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:976)
06-28 09:32:24.338: W/VideoView(16454): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:955)
06-28 09:32:24.338: W/VideoView(16454): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:918)
06-28 09:32:24.338: W/VideoView(16454): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:870)
06-28 09:32:24.338: W/VideoView(16454): at android.widget.VideoView.openVideo(VideoView.java:236)
06-28 09:32:24.338: W/VideoView(16454): at android.widget.VideoView.access$2000(VideoView.java:52)
06-28 09:32:24.338: W/VideoView(16454): at android.widget.VideoView$6.surfaceCreated(VideoView.java:490)


when using the following code :



String cacheDir = getApplicationContext().getCacheDir().getAbsolutePath();
Log.d("video path",cacheDir+"/intro.mp4");
vvIntro.setVideoPath(cacheDir+"/intro.mp4");
vvIntro.start();


I want to play a video stored in cache folder


























First check your file permission. And try without the .mp4 extension if there is no other file on the same name otherwise try with a .3gp file similarly without extension.























Maybe MediaPlayer requires MODE_WORLD_READABLE for your Intro file. Try to save it in none PRIVE mode.


Or you forgot to add permission for READING internal storage.























default






.

stackoverflow.comm



Thursday, June 27, 2013

[General] Can I use my old Droid Bionic as on a straight talk plan?


Can I use my old Droid Bionic as on a straight talk plan?



I just bought a Samsung Galaxy S4, which I love, but anyway I was wondering could my girlfriend take my Bionic and use it on a straight talk plan? I am either going to buy her a good straight talk phone or let her use my Bionic, but I'd much rather save the $ and use the Bionic if I could especially considering it's going to be a better phone anyway for her. If it's possible to do this what are the necessary steps?



.

forum.xda-developers.com



[General] SD Card damaged on the Galaxy S2, Help?


SD Card damaged on the Galaxy S2, Help?



Okay so pardon me for my bad grammar but here's what i did

I used Notpod to transfer music into my Galaxy S2 in the SD Card file but after I disconnected there was a notification saying "Media Scanner Running" And after it finished scanning it gave me a notification that the SD Card have been damaged, try reformatting. I formatted the SD card and proceed to redo the whole thing again only to get the same messaged. I've restarted my phone, I've took the SD card out and put it back in but nothing seems to work.

Any suggestions?



.

forum.xda-developers.com



[General] Retrieve deleted pictures?


Retrieve deleted pictures?



I accidentally deleted all of the pictures I had taken on my droid razr maxx. I thought I was deleting one picture, but it was the entire album!! Is there anything I can do retrieve them? No, I had not backed up any of them to assistant!



.

forum.xda-developers.com



[General] I Have 2 Questions: iSMS2droid & Clean Master


I Have 2 Questions: iSMS2droid & Clean Master



Im new to the Androis market. Ive just merged all my iphone sms to my Galaxy Note 2 using iSMS2droid. Is it now okay for me to uninstall both of the apps (SMS Backup & Restore aswell) ?

Also am I better off using Clean Master to uninstall apps or using Application Manager?

Thanka a lot.



.

forum.xda-developers.com



[General] LiveSuit stops stays at 0%


LiveSuit stops stays at 0%



I have tried to flash a rom using LiveSuit (1.07 and 1.09) but, although it seems to start correctly, displaying '3 mins to go and 3% complete, it then reverts back to 0% and remains stubbornly at 0% even an hour or more later. Is there anything I can do to cure this? The device manager in Windows shows the device with a yellow exclamation mark and when I try to update the driver it just says the driver is already up to date.



.

forum.xda-developers.com



[General] stock recovery image for karbonn a4+


stock recovery image for karbonn a4+



I accidentally flashed the wrong recovery image on my karbonn a4+ using mobileuncle tools . The phone is stuck in recovery mode and I am unable to make a selection in recovery. How can I flash the correct version of stock recovery. i cant factory reset in my phone. plz give a solution ......



.

forum.xda-developers.com



[android help] How to get message field in a rich push notification


How to get message field in a rich push notification



I'm developing an application with a notification inbox using Urban Airship.


A rich push notification contains title and message. It's sent as a JSONObject, i.e.:



{"aliases": ["user@mail.com"], "push": {"aps": {"alert": "ei!"}}, "title": "New notification", "message": "This is a rich push test!"}



When I get my inbox and I try to open a RichPushMessage, I only can get title and send date. There isn't a method to get the JSONObject (UrbanAirship API)


How I could retrieve the message field? I've seen about "RichPushMessageView" component, but I don't like to show the notification as a webpage. I only need the message field and show it in a textview.



.

stackoverflow.comm



[android help] TileProvider using local tiles


TileProvider using local tiles




  1. You can put tiles into assets folder (if it is acceptable for the app size) or download them all on first start and put them into device storage (SD card).




  2. You can implement TileProvider like this:





public class CustomMapTileProvider implements TileProvider {
private static final int TILE_WIDTH = 256;
private static final int TILE_HEIGHT = 256;
private static final int BUFFER_SIZE = 16 * 1024;

private AssetManager mAssets;

public CustomMapTileProvider(AssetManager assets) {
mAssets = assets;
}

@Override
public Tile getTile(int x, int y, int zoom) {
byte[] image = readTileImage(x, y, zoom);
return image == null ? null : new Tile(TILE_WIDTH, TILE_HEIGHT, image);
}

private byte[] readTileImage(int x, int y, int zoom) {
InputStream in = null;
ByteArrayOutputStream buffer = null;

try {
in = mAssets.open(getTileFilename(x, y, zoom));
buffer = new ByteArrayOutputStream();

int nRead;
byte[] data = new byte[BUFFER_SIZE];

while ((nRead = in.read(data, 0, BUFFER_SIZE)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();

return buffer.toByteArray();
} catch (IOException e) {
e.printStackTrace();
return null;
} catch (OutOfMemoryError e) {
e.printStackTrace();
return null;
} finally {
if (in != null) try { in.close(); } catch (Exception ignored) {}
if (buffer != null) try { buffer.close(); } catch (Exception ignored) {}
}
}

private String getTileFilename(int x, int y, int zoom) {
return "map/" + zoom + '/' + x + '/' + y + ".png";
}
}


And now you can use it with your GoogleMap instance:



private void setUpMap() {
mMap.setMapType(GoogleMap.MAP_TYPE_NONE);

mMap.addTileOverlay(new TileOverlayOptions().tileProvider(new CustomMapTileProvider(getResources().getAssets())));

CameraUpdate upd = CameraUpdateFactory.newLatLngZoom(new LatLng(LAT, LON), ZOOM);
mMap.moveCamera(upd);
}


In my case I also had a problem with y coordinate of tiles generated by MapTiler, but I managed it by adding this method into CustomMapTileProvider:



/**
* Fixing tile's y index (reversing order)
*/
private int fixYCoordinate(int y, int zoom) {
int size = 1 << zoom; // size = 2^zoom
return size - 1 - y;
}


and callig it from getTile() method like this:



@Override
public Tile getTile(int x, int y, int zoom) {
y = fixYCoordinate(y, zoom);
...
}


[Upd]


If you know exac area of your custom map, you should return NO_TILE for missing tiles from getTile(...) method.


This is how I did it:



private static final SparseArray TILE_ZOOMS = new SparseArray() {{
put(8, new Rect(135, 180, 135, 181 ));
put(9, new Rect(270, 361, 271, 363 ));
put(10, new Rect(541, 723, 543, 726 ));
put(11, new Rect(1082, 1447, 1086, 1452));
put(12, new Rect(2165, 2894, 2172, 2905));
put(13, new Rect(4330, 5789, 4345, 5810));
put(14, new Rect(8661, 11578, 8691, 11621));
}};

@Override
public Tile getTile(int x, int y, int zoom) {
y = fixYCoordinate(y, zoom);

if (hasTile(x, y, zoom)) {
byte[] image = readTileImage(x, y, zoom);
return image == null ? null : new Tile(TILE_WIDTH, TILE_HEIGHT, image);
} else {
return NO_TILE;
}
}

private boolean hasTile(int x, int y, int zoom) {
Rect b = TILE_ZOOMS.get(zoom);
return b == null ? false : (b.left <= x && x <= b.right && b.top <= y && y <= b.bottom);
}


.

stackoverflow.comm



Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...