小编sil*_*aut的帖子

如何在包含的布局上设置 onClickListener?

我有一个包含在其他几个布局中的 ImageButton 布局。

图像按钮布局:

call_cancelled.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:id="@+id/callEndLayout"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:height="70dip"
    android:orientation="horizontal"
    android:paddingBottom="5dp"
    android:paddingTop="5dp" >

    <ImageButton
        android:id="@+id/phoneEnd"
        android:layout_width="63dp"
        android:layout_height="63dp"
        android:paddingBottom="7dp"
        android:background="@drawable/phone_cancelled"  />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的包括:

  <include
   android:id="@+id/includeCallEnd0"
   android:layout_width="70dp"
   android:layout_height="70dp"
   android:layout_alignBottom="@+id/include"
   android:layout_alignParentRight="true"
   layout="@layout/call_cancelled" />
Run Code Online (Sandbox Code Playgroud)

对于这包括我在按下时需要一个 onClickListener 。 我试过这个:

View endcall0 = (View) findViewById(R.id.includeCallEnd0);

 endcall0.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            Intent callIntent = new Intent(Intent.ACTION_CALL_BUTTON);
            startActivity(callIntent);

            int id = viewFlipper.getDisplayedChild();

            if (id == 0) {
                hideSoftKeyboard();
            }
        }
     });
Run Code Online (Sandbox Code Playgroud)

但它不起作用。有人知道解决方案吗?

android onclicklistener

8
推荐指数
1
解决办法
1万
查看次数

"PowerManger.FULL_WAKE_LOCK被弃用"是什么意思?

我有这个代码:

wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
            | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
Run Code Online (Sandbox Code Playgroud)

FULL_WAKE_LOCK被划掉了,它说"PowerManger.FULL_WAKE_LOCK已被弃用".代码正在运行.但究竟是什么意思呢?它能引起任何问题吗?

android wakelock powermanager

7
推荐指数
1
解决办法
1万
查看次数

如何设置tomcat的IP地址?

我有一个运行.war文件的Tomcat服务器.

我可以在浏览器中键入localhost:8080/..时运行.war文件.

但我必须通过网络到达这个.war文件.所以我有一个带有域名的外部IP.

在浏览器中输入xx.xxx.xxx.xxx:8080/ ..我应该到达.war文件.

因此,此IP地址应指向其localhost,并进一步指向.war文件.

我怎样才能做到这一点?

java tomcat web-services ip-address

6
推荐指数
2
解决办法
4万
查看次数

如何在4.0+上更改Edittext下划线的颜色?

我有我的应用Theme.Holo,但我想更改edittext的下划线边框的颜色.

我不希望编辑文本周围有完整的边框.我只想在版本4.0+上更改edittext布局的颜色.

我怎样才能做到这一点?

java android colors android-edittext

5
推荐指数
2
解决办法
2万
查看次数

如何检查设备的蓝牙连接是否断开?

我想知道我与设备的蓝牙连接何时断开连接.我发现这个要检查:

    IntentFilter filter1 = new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED);
    IntentFilter filter2 = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
    IntentFilter filter3 = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED);
    this.registerReceiver(mReceiver, filter1);
    this.registerReceiver(mReceiver, filter2);
    this.registerReceiver(mReceiver, filter3);

  //The BroadcastReceiver that listens for bluetooth broadcasts
   mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

            if (BluetoothDevice.ACTION_FOUND.equals(action)) {
               //Device found
            }
            else if (BluetoothAdapter.ACTION_ACL_CONNECTED.equals(action)) {
               //Device is now connected
            }
            else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                //Done searching
            }
            else if (BluetoothAdapter.ACTION_ACL_DISCONNECT_REQUESTED.equals(action)) {
               //Device is about to …
Run Code Online (Sandbox Code Playgroud)

android android-bluetooth

5
推荐指数
1
解决办法
2万
查看次数

证书不包含与服务器名称匹配的ID

我正在使用XAMPP并启动了Apache,但无法通过HTTPS访问我的站点。

我收到以下错误;

[2014年8月20日,星期三08:05:33.208723] [ssl:warn] [pid 3784:tid 256] AH01909:为www.example.com:443配置的RSA证书不包含与服务器名称匹配的ID [8月20日,星期三2014年08:05:33.746774] [ssl:warn] [pid 3784:tid 256] AH01909:为www.example.com:443配置的RSA证书不包含与服务器名称匹配的ID [8月20日星期三08:05: 2014年3月33日] [mpm_winnt:notice] [pid 3784:tid 256] AH00455:已配置Apache / 2.4.7(Win32)OpenSSL / 1.0.1e PHP / 5.5.6-恢复正常操作[星期三8月20 08:05:33.825871 2014] [mpm_winnt:notice] [pid 3784:tid 256] AH00456:内置的Apache Lounge VC11服务器:2013年11月21日20:13:01 [2014年8月20日星期三08:05:33.825871] [core:notice] [pid 3784: tid 256] AH00094:命令行:“ c:\ xampp \ apache \ bin \ httpd.exe -d C:/ xampp / apache” [8月20日星期三08:05:33。830753 2014] [mpm_winnt:notice] [pid 3784:tid 256] AH00418:父级:创建的子进程4452 [2014年8月20日星期三08:05:35.148052] [ssl:warn] [pid 4452:tid 268] AH01909:RSA证书为www.example.com:443配置的不包含与服务器名称匹配的ID

以下是我httpd-ssl.conf文件的摘录:

# SSL Virtual Host Context
<VirtualHost _default_:443> …
Run Code Online (Sandbox Code Playgroud)

apache xampp ssl

5
推荐指数
2
解决办法
5万
查看次数

什么意味着MediaPlayer上的消息"内部/外部状态不匹配"?

我使用MediaPlayer并通常以编程方式设置播放器的状态,例如:

 if(mp.isPlaying()) {
    mp.pause();
    animationPausedMusic();

  }

private void animationPausedMusic() {

  // Changing button image to play button
    btn_play.setBackgroundResource(R.drawable.play);

  ... // more code
}
Run Code Online (Sandbox Code Playgroud)

但有时logcat给我的信息是:

"纠正了内部/外部状态不匹配"

然后播放和暂停功能不再起作用.

这条消息是什么意思?我该如何解决?

android android-mediaplayer

3
推荐指数
1
解决办法
3441
查看次数

如何在postDelayed模式下停止处理程序?

如果不再计算Handler的计数器怎么能停止?也许你可以告诉我如何处理下面的代码.

 public void handler() {
    nHandler.postDelayed(new Runnable() {
        @Override
        public void run() {

                viewFlipper.setDisplayedChild(8);
        }
    }, 20000);
}
Run Code Online (Sandbox Code Playgroud)

android handler runnable

2
推荐指数
1
解决办法
5160
查看次数

GET请求JSONObject android

我做了一个简单的GET请求,如果我的登录名和密码是正确的,则返回1或0.我在另一个线程上建立连接.

像这样 :

public void getConnection(){

    String url = null;

    url = NOM_HOTE + PATH_METHODE + "identifiant="+ identifiant.getText().toString() + "&password="+ password.getText().toString();

     HttpClient httpClient = new DefaultHttpClient();

     try{
         HttpGet httpGet = new HttpGet(url);
         HttpResponse httpResponse = httpClient.execute(httpGet);
         HttpEntity httpEntity = httpResponse.getEntity();

         if(httpEntity != null){


             InputStream inputStream = httpEntity.getContent();

             //Lecture du retour au format JSON
             BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
             StringBuilder stringBuilder = new StringBuilder();

             String ligneLue = bufferedReader.readLine();
             while(ligneLue != null){
                 stringBuilder.append(ligneLue + " \n");
                 ligneLue = bufferedReader.readLine();
             }
             bufferedReader.close(); …
Run Code Online (Sandbox Code Playgroud)

connection android json get http

2
推荐指数
1
解决办法
4666
查看次数