小编Yas*_*nth的帖子

从recyclerview android获取已选中复选框的列表

我已经使用图像,标题和复选框填充了recyclerView.我有两个问题.

  1. 如何在单击imageview或整个回收项目时选中复选框.

  2. 我必须通过从recyclerview获取所有选中的项目来进行下一个活动.

我的布局:

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp">

        <ImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:layout_gravity="center_horizontal"
            android:contentDescription="Interests"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_yash_dp" />

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_gravity="bottom"
            android:layout_margin="5dp"
            android:layout_marginTop="24dp"
            android:background="@drawable/rounded_corners"
            android:gravity="bottom"
            android:padding="5dp"
            android:text="GYM"
            android:textAlignment="center"
            android:textColor="@color/white" />

        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/checkBox"
            android:layout_margin="2dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />

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

我的适配器:

@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
final InterestBean model = arrayList.get(position);
final int pos = position;

RecyclerViewHolder mainHolder = (RecyclerViewHolder) holder;// holder

Bitmap image = BitmapFactory.decodeResource(context.getResources(),
        model.getImage());// This will convert drawbale image into …
Run Code Online (Sandbox Code Playgroud)

checkbox android recycler-adapter android-recyclerview

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

React Native 构建在 android 中失败,@react-native-community/cli-platform-android /native_modules.gradle' line: 130

我已将我的 ReactNative 项目从0.59升级到 0.61.2 iOS 构建良好,但在 android 中我面临@react-native-community/cli-platform-android模块中的问题。

我的settings.gradle文件

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Run Code Online (Sandbox Code Playgroud)

我的build.gradle文件

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Run Code Online (Sandbox Code Playgroud)

构建应用程序时出现以下错误。

> Task :app:generatePackageList FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android
/native_modules.gradle' line: 130

* What went wrong:
Execution failed for task ':app:generatePackageList'.
> ReactNativeModules$_generatePackagesFile_closure3

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with …
Run Code Online (Sandbox Code Playgroud)

android gradle reactjs react-native

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

在android中自定义progressdialog动态创建

我动态地在asynctask中创建了progressdialog.我为我的应用程序使用自定义样式.当我这样做,我的progressdialog风格改为白色我需要我的黑色默认风格与白色文本.

我的java文件:

class LoginTask extends AsyncTask<Void, Void, Void> {

private final ProgressDialog dialog = new ProgressDialog(Login.this);

@Override
protected void onPreExecute() {
    this.dialog.setMessage("Logging in...");
    this.dialog.show();
}

 // my prog

@Override
    protected void onPostExecute(Void result) {
        if (this.dialog.isShowing()) {
        this.dialog.dismiss();
        }}
Run Code Online (Sandbox Code Playgroud)

我的style.xml:

 <style name="AppBaseTheme" parent="android:Theme.Light">

</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:windowBackground">@drawable/blue</item>
    <item name="android:textColor">@color/white</item>
    <item name="android:editTextColor">@color/white</item>
    <item name="android:buttonStyle">@android:style/Widget.Holo.Button</item>
    <item name="android:dropDownSpinnerStyle">@android:style/Widget.Holo.Spinner</item>
    <item name="android:textAppearanceButton">@android:style/TextAppearance.Widget.Button</item>
    <item name="android:progressBarStyle">@style/ProgressBar</item> …
Run Code Online (Sandbox Code Playgroud)

android progressdialog android-progressbar

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

启动包中没有指定postgresql用户名

public class HelloPostgreSQLActivity extends Activity {
    TextView resultArea;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        resultArea = new TextView(this);
        resultArea.setText("Please wait.");
        setContentView(resultArea);
        new FetchSQL().execute();

    }
    private class FetchSQL extends AsyncTask <Void,Void,String> {


        @Override

        protected String doInBackground(Void... params) {
            //TextView tv=(TextView)findViewById(R.id.text);
            String retval = "";
           // String msg="connected";
            try {
                Class.forName("org.postgresql.Driver");
               // tv.setText(msg);  

            }  
             catch (ClassNotFoundException e) {
                e.printStackTrace();
                retval = e.toString();
            }
            String url = "jdbc:postgresql://192.168.1.92/postgres? user = postgres & password = admin";
            Connection conn;
            try {
                DriverManager.setLoginTimeout(25);
                conn = …
Run Code Online (Sandbox Code Playgroud)

java authentication android jdbc jdbc-postgres

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