小编Rad*_*Rad的帖子

Android - 存储/检索具有共享首选项的字符串

正如标题所说,我想保存并检索某些字符串.但我的代码不会在检索或存储中通过第一行.我尝试按照以下链接:http://developer.android.com/guide/topics/data/data-storage.html

private void savepath(String pathtilsave, int i) {
    String tal = null;
    // doesn't go past the line below
    SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
    tal = String.valueOf(i);
    editor.putString(tal, pathtilsave);
    editor.commit();
}
Run Code Online (Sandbox Code Playgroud)

和我的检索方法:

public void getpaths() {
    String tal = null;
    // doesn't go past the line below
    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    for (int i = 1; i <= lydliste.length - 1; i++) {
        tal = String.valueOf(i);
        String restoredText = settings.getString(tal, null);
        if (restoredText != null) {
            lydliste[i] …
Run Code Online (Sandbox Code Playgroud)

android sharedpreferences

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

Ionic Cordova中的Stripe Connect - 无法重定向回应用程序

框架: Ionic Cordova

API: Stripe Connect(允许用户相互发送付款).

获取付款的注册过程是通过Stripe Connects自己的外部窗口进行的.注册Stripe Connect时,它使用重定向URI(在我的Stripe帐户的设置中设置)返回到您带有身份验证代码的屏幕.这适用于浏览器(因为重定向URI设置为localhost或IP),但手机上实际运行的应用程序没有,因为应用程序没有URL.因此它显示"站点不可访问/不存在"浏览器错误消息.

我目前使用以下方法打开Stripe Connect注册屏幕:

  var link = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=MYCLIENTID&scope=read_write";

    window.open(link, '_blank', 'location=no');
Run Code Online (Sandbox Code Playgroud)
  • 我已经向Stripe支持寻求帮助,但他们没有解决方案.

  • 我已尝试使用自定义URL方案为应用程序提供URL - 但Stripe仅允许"Http://"URL,而不是自定义URL方案提供的CoolAppName //:.

  • 请不要对此感到困惑:如果我在cmd中运行"ionic run -l",然后使用给定的URL作为Redirect URI,它实际上也会使用手机上的身份验证代码重定向回来.但是,删除存储在应用程序中的每个信息,因此它"忘记"用户登录的内容.当然,此解决方案也只能在本地使用.

任何建议表示赞赏.

提前致谢.

redirect cordova ionic-framework stripe-connect

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

PhoneGap - 如果在按下Google地图"使用条款"时如何取回?

我正在PhoneGap上制作这个包含地图的应用程序.在标准Google地图上,右下角有一个"使用条款".如果我单击此按钮,将打开一个全新的屏幕.但我无法使用集成的Android Backbutton.

我该怎么办?

在项目的其他地方,我已经使用了这个(在此下面)javascript来回到上一个屏幕 - 但由于"使用条款"屏幕不是JS文件,我该如何告诉它它能够/不能做(回到上一个屏幕)?

document.addEventListener("backbutton", function(e){
    e.preventDefault();
    navigator.app.backHistory();
}, true);
Run Code Online (Sandbox Code Playgroud)

javascript android google-maps cordova

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

Phonegap - javascript longpress

我已经尝试了一段时间来完成这项工作.这种方法似乎在互联网上的几个地方工作,但不适合我.请注意,这在Dreamweaver(和chrome)中有效,但在我的手机上试用时,不适用于Eclipse Indigo(Phonegap).

 $("#button4").mouseup(function(){
 //  clearTimeout(pressTimer);
    pressTimer = 0;
   // Clear timeout
   return false;
 }).mousedown(function(){
   // Set timeout
   pressTimer = window.setTimeout(function() { test(); },1000);
   return false; 
 });

 function test ()
 {alert("Longpress works");}
Run Code Online (Sandbox Code Playgroud)

正常的"点击"也适用于"button4".

javascript jquery click cordova

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