toast

Android Youtube Player Api - ERROR_CONNECTING_TO_SERVICE

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use the new api youtube. I followed the examples provided, but I get the error: ERROR_CONNECTING_TO_SERVICE The "API key" that I'm using is correct (since it works correctly in the google demos). Imports: import com.google.android.youtube.player.YouTubeBaseActivity; import com.google.android.youtube.player.YouTubeInitializationResult; import com.google.android.youtube.player.YouTubePlayer; import com.google.android.youtube.player.YouTubePlayer.Provider; import com.google.android.youtube.player.YouTubePlayerView; Classe

Eclipse Juno/Android broken, the debug is wrong and gen folder not created (R error)

匿名 (未验证) 提交于 2019-12-03 01:01:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a very very strange issue, and i believe my elcipse juno is broken. I have the Android ADT plugin in this eclipse. The following screenshot will prove my believe. And its not finished yet. After the screenshot above, i press F6 again, and this is what i got : I will explain this case once again to make a clear question. I debug my application, then i got that the arg2 value is 1. After that, i press f6 and the code goes to case 0 (instead of case 1) and then i press f6 again and the code goes to case 6 (WTF????? i do have a break ,

Android: Transfering Data via ContentIntent

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got a problem with my Android Application. It receives Messages via Google Cloud Messaging and displays a Notification in the Notificationbar. I want to transfer some Data with the Notification. This Data comes via Google Cloud Messaging and should be attatched to the Notification. This is my Code to Display the Notification: private void setNotification(String strTitle, String strMessage, int intPageId, int intCategorieId) { notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Intent

WebView not showing correctly

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: WebView is not showing website correctly. Any help would be great! The code ive used work on all another site. Not sure whats the issue. Any thing I should add? Works well in chrome and other browsers so don't know what to do. Any help would be great! WebView Chrome public class Website extends Activity { WebView myWebView; LinearLayout root; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.website); myWebView = (WebView) findViewById(R.id.webView); root =

原生实现小黑框toast

匿名 (未验证) 提交于 2019-12-03 00:37:01
首先写一个函数来实现弹出框的功能 function myAlert ( text , time ) { if (! document . getElementById ( 'alertBg' )) { let _time = time || 1000 ; let parent = document . createElement ( 'div' ); parent . setAttribute ( 'id' , 'alertBg' ); let child = document . createElement ( 'p' ); child . setAttribute ( 'class' , 'text' ); let _text = document . createTextNode ( text ); child . appendChild ( _text ); parent . appendChild ( child ); document . body . appendChild ( parent ); setTimeout ( function () { document . body . removeChild ( parent ); }, _time ) }; } 然后写css样式 /*弹出提示框*/ #alertBg { position : absolute ;

关于Android7.x系统Toast显示异常BadTokenException解决方案

匿名 (未验证) 提交于 2019-12-03 00:30:01
Fatal Exception: android .view .WindowManager $BadTokenException: Unable to add window -- token android .os .BinderProxy @fcd9ef6 is not valid ; is your activity running? at android .view .ViewRootImpl .setView (ViewRootImpl .java : 806 ) at android .view .WindowManagerGlobal .addView (WindowManagerGlobal .java : 369 ) at android .view .WindowManagerImpl .addView (WindowManagerImpl .java : 94 ) at android .widget .Toast $TN .handleShow (Toast .java : 459 ) at android .widget .Toast $TN$2 .handleMessage (Toast .java : 342 ) at android .os .Handler .dispatchMessage (Handler .java : 102 ) at

点击事件OnClickListener接口重写onClick方法实现

匿名 (未验证) 提交于 2019-12-03 00:29:01
OnClickListener接口重写 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" > <Button android:id="@+id/btn1" android:layout_width="100dp" android:layout_height="40dp" android:text="点击1" /> </LinearLayout> Java: package com.example.zy.mystudy; import android.app.Activity; import android.content.DialogInterface;

深入分享一下android.widget.Toast

匿名 (未验证) 提交于 2019-12-03 00:26:01
Toast.LENGTH_SHORT 和 Toast.LENGTH_LONG 两种,前者是2s,后者是显示3.5s。嗯,有些页面的确显示有问题,short太短,long太短,搞得比较尴尬,所以需要分析一下,这Toast到底是怎么运行的,我能不能修改这个时间,让它要多长有多长呢? 我希望你读完这篇文章之后,能了解深层次的Toast运行原理。 Toast .makeText (activity, "hello world" , Toast .LENGTH _SHORT) .show () ; // or Toast .makeText (activity, "hello world" , Toast .LENGTH _LONG) .show () ; 通过源码分析,makeText()方法中,主要是获取LayoutInflater获取一个TextView,这个TextView就是我们的Toast需要显示的View,这个很简单,就不说了,主要来看一下show()方法: /** * 显示特定时长的View */ public void show () { //代码省略 INotificationManager service = getService(); String pkg = mContext.getOpPackageName(); TN tn = mTN; tn.mNextView

Android广播接收者使用总结

匿名 (未验证) 提交于 2019-12-03 00:26:01
Ŀ¼ Ŀ¼ 但是只有广播接收者可以使用java代码的方法来动态注册 。 BroadcastReceiver是用于接收广播的组件用于组件与组件之间进行通信,可以跨应用程序传递. 如操作系统电池电量低会发送一个广播,这样我们的程序里面可以去监听这个广播,可以关 闭程序里面比较耗电的功能,提示用户注意保存进度什么的,还如其它安装新应用等,还有普通应 用程序,例如启动特定线程,文件下载完毕等。 广播的发送的一般应用场合:发送频率低的情况可以使用,数据量小的情况可以使用。 在onReceive方法内,我们可以获取随广播而来的Intent中的数据,这非常重要,就像无线电一样,包含很多有用的信息。 在创建完我们的BroadcastReceiver之后,还不能够使它进入工作状态,我们需要为它注册一个指定的 广播地址 。没有注册广播地址的BroadcastReceiver就像一个缺少选台按钮的收音机,虽然功能俱备,但也无法收到电台的信号。所以创建类后就要对BroadcastReceiver进行注册。 public class MyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive (Context context, Intent intent) { //对接收到的广播进行处理