如何敬酒一个特定时间段的信息呢? [英] How to toast a message for a specific time period?
问题描述
我已经取得了一些code为我的谷歌地图,在这里我将相机放置在一个地方当相机定位在第一名我敬酒的消息,然后我将摄像机移动到另一个位置,但问题是该敬酒操作不会为了读取消息出现足够的时间。反正是有这样我就可以设置敬酒可以说10秒左右?这里是我的code。
公共无效onFinish(){
的LatLng 1 =新经纬度(X,Y);
的LatLng 2 =新经纬度(X,Y);
使用GoogleMap地图=((MapFragment)getFragmentManager()findFragmentById(R.id.map)。)的GetMap();
map.animateCamera(CameraUpdateFactory.zoomTo(10),30000,NULL);Toast.makeText(getBaseContext(),我想这个消息显示10秒钟。
Toast.LENGTH_SHORT)
。显示();CameraPosition cameraPosition3 =新CameraPosition.Builder()
.TARGET(1)
.zoom(16).bearing(300)
.tilt(30)
。建立(); map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition3),30000,新
CancelableCallback(){公共无效onFinish(){ 的LatLng 2 =新经纬度(X,Y); 使用GoogleMap地图=((MapFragment)getFragmentManager()findFragmentById(R.id.map)。)的GetMap();
map.animateCamera(CameraUpdateFactory.zoomTo(10),30000,NULL);
Toast.makeText(getBaseContext(),此消息10秒。Toast.LENGTH_SHORT)
CameraPosition cameraPosition3 =新CameraPosition.Builder()
.TARGET(2)
.zoom(16) .bearing(300)
.tilt(30)
。建立();map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition3),30000,NULL);
试试这个肯定它会帮助你,我已经尝试过了。
最后吐司面包= Toast.makeText(getBaseContext(),您的信息,Toast.LENGTH_SHORT);
toast.show();
新CountDownTimer(10000,1000)
{
公共无效onTick(长millisUntilFinished){toast.show();}
公共无效onFinish(){toast.cancel();}
}。开始();
得到的答案来自这个问题请参考的全部细节
<$p$p><$c$c>http://stackoverflow.com/questions/2220560/can-an-android-toast-be-longer-than-toast-length-longI have made some code for my google map, where I position the camera to one place when the camera is positioned to the first place I toast a message and then I move the camera to another position but the problem is that the toast action doesn't appear for enough time in order to read the message. Is there anyway so I can set the toast lets say for 10 seconds or so ? Here is my code.
public void onFinish() {
LatLng 1= new LatLng(x , y);
LatLng 2= new LatLng(x , y);
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.animateCamera(CameraUpdateFactory.zoomTo(10), 30000,null);
Toast.makeText(getBaseContext(), " I want this message to displayed for 10 seconds.",
Toast.LENGTH_SHORT)
.show();
CameraPosition cameraPosition3 = new CameraPosition.Builder()
.target(1)
.zoom(16)
.bearing(300)
.tilt(30)
.build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition3 ),30000,new
CancelableCallback()
{ public void onFinish() {
LatLng 2= new LatLng(x, y);
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.animateCamera(CameraUpdateFactory.zoomTo(10), 30000,null);
Toast.makeText(getBaseContext(), " This message for 10 seconds.", Toast.LENGTH_SHORT)
CameraPosition cameraPosition3 = new CameraPosition.Builder()
.target(2)
.zoom(16)
.bearing(300)
.tilt(30)
.build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition3 ),30000,null);
Try this surely it will help you i already tried it
final Toast toast = Toast.makeText(getBaseContext(), "YOUR MESSAGE",Toast.LENGTH_SHORT);
toast.show();
new CountDownTimer(10000, 1000)
{
public void onTick(long millisUntilFinished) {toast.show();}
public void onFinish() {toast.cancel();}
}.start();
got the answer from this question please refer for full details
http://stackoverflow.com/questions/2220560/can-an-android-toast-be-longer-than-toast-length-long
这篇关于如何敬酒一个特定时间段的信息呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!