小编Nir*_*ari的帖子

Android软键盘无法在webView`中打开

我在AlertDialog中使用WebView来验证用户到twitter.但是当我点击webview中的字段时,android键盘不会打开.这是我的代码,显示我如何在警报对话框中添加webview.我隐含地调用android键盘,但它在警告对话框后面打开键盘.

这是我的代码.

public static void webViewDialog(final String authorizationURL, final int type)
{

    final boolean correctPin;
    System.out.println("In webViewDialog");
    container = new LinearLayout(context);
    container.setOrientation(LinearLayout.VERTICAL);

    container.setMinimumWidth(200);
    container.setMinimumHeight(320); 

    webView = new WebView(context);
    webView.setMinimumWidth(200);
    webView.requestFocusFromTouch();
    webView.setMinimumHeight(380);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new TwitterWebViewClient());
    webView.loadUrl(authorizationURL);
    webView.setBackgroundColor(0xFFbbd7e9);
    container.addView(webView);

    Builder webDialog = new AlertDialog.Builder(context);

    webDialog.setView(container).setTitle("Twitter Login")
            .setPositiveButton("Ok", new DialogInterface.OnClickListener()
        {

                @Override
                public void onClick(DialogInterface dialog, int which) 
                {

                    if (type == 0) 
                    {
                          twitterPinCodeDialog();
                        dialog.dismiss();

                    }
                }
        }).show();
    showVirtualKeyboard();

}
public static void showVirtualKeyboard()
{
    Timer timer = new Timer();
    timer.schedule(new TimerTask() …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-layout

10
推荐指数
2
解决办法
8425
查看次数

无法在VideoView中播放.mov文件

我正在开发一个应用程序,我必须从Internet播放视频.我正在使用videoview播放视频.

缓冲完成后,我的模拟器向我显示一个错误,表示无法播放视频.

我不知道错误是什么.

android android-emulator

9
推荐指数
2
解决办法
7016
查看次数

@在HTTPPost请求中转换为%40

我试图发送邮件请求到webservice ..当我在参数中添加特殊字符@它被转换为%40.i已检查服务器端..他们正在获得%40而不是@.谁能帮我??这是我的代码..

httpclient = new DefaultHttpClient();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("Email", "abc@gmail.com"));


httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
 ResponseHandler<String> responseHandler = new BasicResponseHandler();
String response = httpclient.execute(httppost,responseHandler);
Run Code Online (Sandbox Code Playgroud)

我也尝试过这种方法来防止我的参数编码.

httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.PLAIN_TEXT_TYPE));
Run Code Online (Sandbox Code Playgroud)

但它提出了不受支持的编码算法

请帮我解决这个问题.

java https android http http-headers

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

如何通过 Biometric api 检查用户的 Bio-Metric 偏好?

众所周知,从 android 9.0 开始,android 引入了BiometricPrompt Api,以在越来越多的生物识别传感器(例如指纹、Face ID 等)中提供标准的身份验证体验。

现在有了这个新的 BiometricPrompt Api,用户可以通过指纹、面部扫描仪或虹膜扫描进行身份验证(取决于他们的生物识别偏好)。BiometricPrompt api 会处理这个问题,它会通过各种回调通知我们。

下面是我显示生物识别提示的代码。

 biometricPrompt = new BiometricPrompt.Builder(context)
            .setTitle("FingerPrint Authentication")
            .setSubtitle("Login via Fingerprint")
            .setDescription("Touch Fingerprint Sensor")
            .setNegativeButton("Cancel", context.getMainExecutor(),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            Log.d(TAG,"Cancelled");
                        }
                    })
            .build();
Run Code Online (Sandbox Code Playgroud)

现在,如果您看到我的代码,我将标题设置为Fingerprint Authentication。现在在设备设置中,如果用户已将生物识别首选项设置为面容 ID而不是指纹,那么此biometricPrompt将通过面容ID对用户进行身份验证,即使用户一直触摸传感器,指纹传感器也不会工作。这会造成混淆,因为生物识别标题说“指纹身份验证”和用户实际上是通过faceID 进行身份验证的

有什么方法可以让我们知道用户选择了什么生物识别偏好(例如指纹或面容 ID)?因此,基于该偏好,我可以在 BiometricPrompt 上显示适当的消息,这样用户就不会感到困惑。

我已经从 BiometricPrompt 探索了所有 api,但可以找到任何与 BiometricPreference 相关的东西。

任何帮助将不胜感激。

android samsung-mobile android-fingerprint-api android-9.0-pie android-biometric-prompt

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

Android蓝牙打印

我正在编写一个将数据发送到蓝牙打印机的应用程序.谁能帮我 ?如何使用Android蓝牙堆栈进行打印?或者是否有任何外部api或sdk使用?

这是我搜索蓝牙的代码...

bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
registerReceiver(ActionFoundReceiver,
        new IntentFilter(BluetoothDevice.ACTION_FOUND));

private final BroadcastReceiver ActionFoundReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (BluetoothDevice.ACTION_FOUND.equals(action)) {
            BluetoothDevice device = intent
                    .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            btArrayAdapter.add(device.getName() + "\n"
                    + device.getAddress());
            btArrayAdapter.notifyDataSetChanged();
        }
    }
};
Run Code Online (Sandbox Code Playgroud)

这是我的数据发送到打印机的代码..

BluetoothDevice mDevice = bluetoothAdapter.getRemoteDevice("00:15:FF:F2:56:A4");
Method m = mDevice.getClass().getMethod("createRfcommSocket",
        new Class[] { int.class });
mBTsocket = (BluetoothSocket) m.invoke(mDevice, 1);
System.out.println("Connecting.....");
mBTsocket.connect();
System.out.println("Connected");
OutputStream os = mBTsocket.getOutputStream();
os.flush();
os.write(Receipt.getBytes());
// mBTsocket.close();
Run Code Online (Sandbox Code Playgroud)

当我写socket.close()时,数据没有打印到打印机,因为套接字连接在打印数据之前关闭..如果我没有写socket.close()那么数据只打印一次..我不会能够第二次打印数据,直到我重新启动手机的蓝牙.

任何人都可以解决它?还是有其他方法可以摆脱这种印刷?

printing android bluetooth

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

在前景方面杀死活动

我写了一个应用程序n一个问题.我有三个活动A,B和C.当我从活动A到B和B到C,如果我按下设备上的菜单按钮.我的应用程序进入后台状态.当我重新打开应用程序时,它显示活动C.我希望当我重新打开我的应用程序时,它应该显示活动A而不是活动堆栈中的任何其他活动.我已经完成了一些活动生命周期方法并试图覆盖它.我有覆盖onStart(),onPause()方法和finsh活动C以及活动B和我遇到的问题是当我从活动C转到活动D活动时C完成所有后台活动nm无法在活动D结束时回到活动C.任何人都可以帮助我如何在应用程序的简历中显示特定的活动?提前解决.

这是我的manifest.xml

<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application    
              android:icon="@drawable/icon"
              android:label="@string/app_name"
              android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >

    <activity   
        android:label="@string/app_name"
        android:name="com.buttonpay.Login"
        android:screenOrientation="portrait"
        android:clearTaskOnLaunch="true" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


     <activity android:name=".ButtonPayActivity"
                android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                android:screenOrientation="portrait"/>    


    <!-- HomeTab Activity -->

            <activity android:name="com.buttonpay.home.Utilities"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>


            <activity android:name="com.buttonpay.home.Top_up"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
            <activity android:name="com.buttonpay.home.HomeScreen"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>

            <activity android:name="com.buttonpay.home.MyAccount"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
             <activity android:name="com.buttonpay.home.TransactionHistory"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
              <activity android:name="com.buttonpay.home.TransactionDetailsActivity"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
                <activity android:name="com.buttonpay.home.TransactionList"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
               <activity android:name="com.buttonpay.home.BusinessSummaryActivity"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>
               <activity android:name=".home.MobileMoneyActivity"
                        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                        android:screenOrientation="portrait"/>


     <!-- balance tab …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-activity

6
推荐指数
1
解决办法
971
查看次数

如何在Android中的ImageView上放置双击事件

我必须在图像视图上放置一个双击事件.每当我双击图像时,它应该是Zoom.But我发现在Image Veiw中没有像双击那样的事件.谁能告诉我怎么做?提前致谢..

android android-widget

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

如何在地图图钉图像上设置索引编号

我正在制作一个地图应用程序,其中我有20个餐厅数据,我想使用覆盖pin显示地图中的所有餐厅.现在我的实际问题是我想在每个引脚上显示索引编号(例如,如果有20针,所有引脚应该是索引号1,2,3,代表餐厅没有列表).任何人都可以告诉我如何将索引号放在单个图像上.. ??我想使用相同的图像进行叠加

android android-widget android-layout

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

如何让J2EI的IMEI支持所有设备?

可能重复:
如何在J2me中动态获取移动IMEI号码?

有没有办法让J2EI支持所有设备的IMEI?我做了一些谷歌搜索并找出以下的解决方案,但它是针对特定设备的.

诺基亚.System.getProperty( "com.nokia.IMEI");

SonyEricsson System.getProperty("com.sonyericsson.imei");

Motorola System.getProperty("com.motorola.IMEI");

是否有任何通用的方法来获取所有设备的IMEI?

java nokia java-me imei

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

如果应用程序已打开或在后台,待定意图不会启动活动

在我的应用程序中,我有一个小部件。如果用户单击小部件,我将使用下面的代码使用挂起的意图打开 SplashScreen。

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    views.setOnClickPendingIntent(R.id.widget_main_layout, pendingIntent);
Run Code Online (Sandbox Code Playgroud)

如果应用程序未打开并启动我的启动屏幕,此代码可以正常工作。

但是,如果应用程序已经打开并在后台,并且如果我单击小部件,则我的 SplashScreen 不会打开,而是只有应用程序出现在前台。

谁能让我知道我的代码有什么问题吗?

android android-widget android-intent android-pendingintent

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

自定义列表字段单击事件

即时编写一个应用程序,我已经创建了自定义列表字段来显示列表视图.我的CustomListField包含一行中的一个图像和文本.im gettiing字段更改监听器点击listfield行但我想把fieldchange监听器放在图像上..任何人都可以告诉我我该怎么做.

这是我的代码.

public class CustomListField extends ListField implements ListFieldCallback {
    private Vector _listData;
    private int _MAX_ROW_HEIGHT = 60;

    public CustomListField(Vector data) {
        _listData = data;
        setSize(_listData.size());
        setSearchable(true);
        setCallback(this);
        setRowHeight(_MAX_ROW_HEIGHT);
    }

    protected void drawFocus(Graphics graphics, boolean on) {
        XYRect rect = new XYRect();
        graphics.setGlobalAlpha(150);
        graphics.setColor(Color.BLUE);
        getFocusRect(rect);
        drawHighlightRegion(graphics, HIGHLIGHT_FOCUS, true, rect.x, rect.y, rect.width, rect.height);
    }

    public int moveFocus(int amount, int status, int time) {
        this.invalidate(this.getSelectedIndex());
        return super.moveFocus(amount, status, time);

    }

    public void onFocus(int direction) {
        super.onFocus(direction);
    }

    protected void onUnFocus() { …
Run Code Online (Sandbox Code Playgroud)

java blackberry listfield blackberry-jde

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

图像上的缩放图像单击事件

我想在图像上放大图像单击事件.我怎样才能做到这一点.这是我的完整代码

main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
     android:layout_height="fill_parent" android:layout_width="fill_parent" >

    <LinearLayout android:orientation="horizontal"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content">

        <Button android:text="Button1" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="wrap_content" ></Button>
        <Button android:text="Button2" android:id="@+id/button2" android:layout_height="wrap_content" android:layout_width="wrap_content" ></Button>
        <Button android:text="Button3" android:id="@+id/button3" android:layout_height="wrap_content" android:layout_width="wrap_content" ></Button>

    </LinearLayout>

    <LinearLayout android:orientation="horizontal"
                  android:layout_height="290dp"
                  android:layout_width="wrap_content"
                  android:layout_gravity="center_horizontal">

             <ImageView android:id="@+id/contentImage"
                        android:layout_height="250dp" 
                        android:layout_width="200dp"
                        />


    </LinearLayout>

    <LinearLayout android:orientation="horizontal"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content">

        <ImageView android:id="@+id/imageView1" android:src="@drawable/img1" android:layout_height="75dp" android:layout_width="75dp" ></ImageView>
        <ImageView android:id="@+id/imageView2" android:src="@drawable/img2" android:layout_height="75dp" android:layout_width="75dp" ></ImageView>
        <ImageView android:id="@+id/imageView3" android:src="@drawable/img3" android:layout_height="75dp" android:layout_width="75dp" ></ImageView>

    </LinearLayout>

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

听到我的主要文件Image.java将在其中处理事件

package com.example;


import android.app.Activity;

import android.graphics.Matrix;
import android.graphics.PointF;
import android.os.Bundle; …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-layout

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

在Android中的GridView中没有触发OnItemClickEvent

即时开发一个应用程序,其中gridview包含按钮列表...

当我在gridview中放置图像而不是按钮然后onItemClickEvent被解雇..但如果我在gridView中放置按钮然后点击事件没有被调用...我不知道是什么问题...即使我没有得到例外..

这是我的代码......

public class MainMenu extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);



    GridView gridview = (GridView) findViewById(R.id.mainMenu);
    gridview.setAdapter(new ImageAdapter(this));

    gridview.setOnItemClickListener(new OnItemClickListener()
    {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id)
        {
            Toast.makeText(MainMenu.this, "hello" + position, Toast.LENGTH_SHORT).show();
        }
    });



}
//inner class for adapter

class ImageAdapter extends BaseAdapter {
    private Context mContext;

    public ImageAdapter(Context c)
    {
        mContext = c;
    }

    public int getCount() {
        return …
Run Code Online (Sandbox Code Playgroud)

java android android-widget android-layout

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