小编Amm*_*mmY的帖子

在android中创建反馈表

我正在我的应用程序中创建一个反馈表。

这就是我要的 :

当用户填写反馈表,然后单击提交按钮时,用户信息将发送到我的电子邮件地址,而无需要求用户登录他/她的帐户,即用户无需我们的电子邮件凭据即可发送反馈。是否可以?

如果是,那么请给出一些提示。

java android user-feedback

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

读取和写入可移动SD卡的文件

如何在Android中读取和写入可移动SD卡的文件?

我想将Android Id存储在文本文件中.应在外部SD卡上创建文本文件.

码:

PackageManager m = getPackageManager();
String s = getPackageName();
PackageInfo p = m.getPackageInfo(s, 0);
s = p.applicationInfo.dataDir;
File myFile = new File(s + "/MyDoople.txt");
myFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
myOutWriter.append(TxtS.getText());
myOutWriter.close();
fOut.close();
Toast.makeText(getBaseContext(),"Text Updated",Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)

第二是

 File sdCard = new File("file:///mnt/external_sd/");
 File myFile = new File(sdCard, "test.txt");
 FileWriter writer = new FileWriter(myFile); 
 writer.append(TESTSTRING);
 writer.flush(); 
 writer.close();
Run Code Online (Sandbox Code Playgroud)

android android-memory

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

LiveData.addSource onChanged事件未调用Android

我正在Kotlin中使用Android Archi + Retrofit + RxAndroid。从服务器获得响应时,我需要更新Data对象。但是livedata.addSource的onChanged没有调用。

我正在从Git代码获取帮助:-https: //github.com/shahbazahmed1269/AndroidGithubIssues

这是我在Kotlin中的代码:-

class LoginRepository : BaseRepository() {

fun callLoginApi(data: HashMap<String, String>): LiveData<LoginResponse> {

    val liveData: MutableLiveData<LoginResponse> = MutableLiveData<LoginResponse>()

//        val call = mApiService.getLoginUser(data)

    mApiService.getLoginUser(data)
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                    { user ->
                        liveData.value = user
                        Log.e("response", user.toString())
                    },
                    { error ->
                        liveData.value = LoginResponse(error = error.localizedMessage)
                        Log.e("Error", error.message)

                    })
    return liveData
}
}


open class LoginViewModel : ViewModel() {
lateinit var loginResponse : MediatorLiveData<LoginResponse>
lateinit var loginRepo:LoginRepository;
init {
    loginResponse = MediatorLiveData<LoginResponse>()
    loginRepo = LoginRepository() …
Run Code Online (Sandbox Code Playgroud)

android kotlin rx-android android-architecture android-architecture-components

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