我试图写一个parcelable数据对象从传递到activityA到activityB在我的Android应用程序.
我的对象是传递所有数据,除了我arraylist的可用服务类
data class AvailableService(val id: Int,
val name: String,
val description: String,
val price: Double,
val currency: String,
val imageUrl: String) : Parcelable {
companion object {
@JvmField @Suppress("unused")
val CREATOR = createParcel { AvailableService(it) }
}
protected constructor(parcelIn: Parcel) : this(parcelIn.readInt(),
parcelIn.readString(),
parcelIn.readString(),
parcelIn.readDouble(),
parcelIn.readString(),
parcelIn.readString())
override fun writeToParcel(dest: Parcel?, flags: Int) {
dest?.writeInt(id)
dest?.writeString(name)
dest?.writeString(description)
dest?.writeDouble(price)
dest?.writeString(currency)
dest?.writeString(imageUrl)
}
override fun describeContents() = 0
}
Run Code Online (Sandbox Code Playgroud)
上面是可用的serviceClass,接下来我有旅行,其持有arraylist的AvailableService …
我的Android模拟器正在关闭此错误消息
运行时错误r6025纯虚函数调用
它经常发生,我该怎么做才能克服这个错误.对此的任何帮助都是赞赏的.
evaluatejavascript可用于 API 级别 19 及更高版本。它有一个回调。我知道我可以在 API 级别 19 之前使用loadUrl代替evaluatejavascriptfor。但是我如何处理脚本的返回值?有解决方案吗?
String script = "function(){ return "abc"}()";
mywebview.loadUrl(script);
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 android 应用程序,在该应用程序中我已将邮件放入文本中textView并且可以点击。我想从邮件中删除下划线。怎么做?
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/mailnlink"
android:textColor="@color/mltext"
android:textColorLink="@color/link"
android:textStyle="italic"
android:gravity="center"
android:autoLink="email"
android:background="@color/mlb"
android:text="@string/f2"/>
Run Code Online (Sandbox Code Playgroud) 我为Android O支持准备我的应用程序,并希望自动填充正常工作.我在系统设置中选择了Google自动填充服务,添加了自动填充的特殊提示.
我已登录dialog延伸DialogFragment.正如在Android开发人员中所写,我不需要任何动作来进行自动填充工作,除了布局" android:autofillHints"和" android:importantForAutofill" 之外,它将自动工作.
但自动填充功能不起作用.
对话框布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/layout_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="yes"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingLeft="21dp"
android:paddingRight="21dp"
android:paddingTop="20dp">
<TextView
style="@style/LoginDialogTextTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button.text.enter" />
<com.myapp.android.views.widgets.TextInputLayout
android:id="@+id/layout_text_email"
android:layout_width="match_parent"
android:layout_height="59dp"
android:layout_marginTop="14dp"
android:hint="@string/label.email"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/text_email"
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="emailAddress"
android:inputType="textEmailAddress"
app:backgroundTint="@color/_gray_text"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout" />
</com.myapp.android.views.widgets.TextInputLayout>
<RelativeLayout
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.myapp.android.views.widgets.TextInputLayout
android:id="@+id/layout_text_password"
android:layout_width="match_parent"
android:layout_height="59dp"
android:hint="@string/hint.password"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
app:passwordToggleEnabled="false">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/text_password"
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:autofillHints="password"
android:inputType="textPassword"
android:paddingRight="100dp" …Run Code Online (Sandbox Code Playgroud) 我使用下面的代码通过使用jsoup 从playstore获取versionName我正在获取详细信息,但它抛出了一些异常.
我的代码是
public class ForceUpdateAsync extends AsyncTask<String, String, JSONObject>{
private String latestVersion;
private String currentVersion;
private Context context;
public ForceUpdateAsync(String currentVersion, Context context){
this.currentVersion = currentVersion;
this.context = context;
}
@Override
protected JSONObject doInBackground(String... params) {
try {
latestVersion = Jsoup.connect("https://play.google.com/store/apps/details?id="+context.getPackageName()+"&hl=en")
.timeout(30000)
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
.referrer("http://www.google.com")
.get()
.select("div[itemprop=softwareVersion]")
.first()
.ownText();
} catch (IOException e) {
e.printStackTrace();
}
return new JSONObject();
}
@Override
protected void onPostExecute(JSONObject jsonObject) {
if(latestVersion!=null){
if(!currentVersion.equalsIgnoreCase(latestVersion)){ …Run Code Online (Sandbox Code Playgroud) 我有一个问题,我有一个的TextInput和按钮内KeyboardAwareScrollView.我希望用户输入一些文本,然后按下使用TouchableOpacity创建的按钮.这将向前发送用户刚输入的文本.
问题是输入文本后,首先尝试TextInput只会失去焦点.只有在下次记者尝试是butto n实际压.如何在第一次按下时按钮有效?
我正在使用这个包https://github.com/APSL/react-native-keyboard-aware-scroll-view
我的代码如下:
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
export default class App extends Component<{}> {
render() {
return (
<KeyboardAwareScrollView>
<TextInput
style={{ width: 100, height: 50, backgroundColor: 'blue' }}
/>
<TouchableOpacity
style={{ backgroundColor: 'red', width: 50, height: 50 }}
/>
</KeyboardAwareScrollView>
);
}
}
Run Code Online (Sandbox Code Playgroud) 我有RecyclerView几个项目类型.它看起来像这样:
当新消息到达时,我按日期和电话排序notifyDataSetChanged().它运作良好,但它会自动滚动我RecyclerView的新项目高度.在这种情况下,我无法使用,notifyItemInserted()因为我不知道排序后的项目位置.
没有通话RecyclerView后如何强制不滚动?notifyDataSetChanged()notifyItemInserted()
我有三件物品 bottomNavigationView
当我单击个人资料项时,代码会检查此人是否已登录。如果此人未登录,则我需要开始一个新的Activityelse 我需要fragment在我的frameLayout.
现在的问题是,当我单击配置文件项并且此人未登录时,活动开始,但是当我单击返回时,配置文件项会突出显示,但主页片段已加载到框架布局中。
我尝试了以下方法来解决这个问题
1)我曾经setSelectedItemId在点击个人资料项目时设置项目颜色但它不起作用
有没有其他方法可以做到这一点?
android android-fragments android-fragmentactivity bottomnavigationview
android ×10
javascript ×2
galaxy ×1
ios ×1
java ×1
jsoup ×1
kotlin ×1
layout ×1
parcelable ×1
r6025 ×1
react-native ×1
reactjs ×1
sdk ×1
webview ×1