小编Sid*_*kan的帖子

检查是否安装了应用程序 - Android

我正在尝试从Google Play安装应用.我可以理解,在打开Goog​​le Play商店网址时,它会打开Goog​​le Play,当我按下后退按钮时,活动会恢复.

Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(appURL));
marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(marketIntent);
Run Code Online (Sandbox Code Playgroud)

当我回到活动时,我试着调用它onResume()来检查应用程序是否已安装,但是我收到错误:

@Override
protected void onResume() {
    super.onResume();
    boolean installed = false;
    while (!installed) {
        installed  =   appInstalledOrNot(APPPACKAGE);
        if (installed) {
             Toast.makeText(this, "App installed", Toast.LENGTH_SHORT).show();
        }
    }
}

private boolean appInstalledOrNot(String uri) {
  PackageManager pm = getPackageManager();
  boolean app_installed = false;
  try {
      pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
      app_installed = true;
  }
  catch (PackageManager.NameNotFoundException e) {
      app_installed = false;
  }
  return app_installed ;
}
Run Code Online (Sandbox Code Playgroud)

错误如下:

E/AndroidRuntime(796):java.lang.RuntimeException:无法启动活动ComponentInfo {com.example.appinstaller/com.example.appinstaller.MainActivity}:android.content.ActivityNotFoundException:找不到处理Intent的活动{act = …

android android-intent google-play

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

Android Market API - Python ImportError:没有名为google.protobuf的模块

基于Python-API,我已经配置并安装了协议缓冲区(如http://worthynote.blogspot.com/2011/05/protobuf-compiler-on-mac.html中所述)和python 2.7.当我运行命令时

python examples.py
Run Code Online (Sandbox Code Playgroud)

并仍然面临错误:

 File "examples.py", line 3, in <module>
import market_proto
File "/Users/siddharthan64/Downloads/android-market-api-py-master/market_proto.py", line 3, in <module>
from google.protobuf import descriptor
ImportError: No module named google.protobuf       
Run Code Online (Sandbox Code Playgroud)

有什么想法在这里出错吗?

python google-play

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

链接器命令错误:找不到架构i386的'ld:符号'

我在编译时遇到错误.似乎很奇怪.它作为详细视图应用程序工作,但使用单一视图似乎不起作用.这是错误细节:

   Undefined symbols for architecture i386:
    "_OBJC_CLASS_$_RssArticle", referenced from:
      objc-class-ref in RssXmlParser.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

xcode compiler-errors mach-o ios

25
推荐指数
4
解决办法
10万
查看次数

为UIButton添加发光效果 - iOS

我有一个UIButton,这是一个标志.这个徽标按钮将永远发光,但触摸时会停止发光.它就像一个发光的动画.

有什么建议吗?

  Undefined symbols for architecture i386:
 "_OBJC_CLASS_$_CABasicAnimation", referenced from:
 objc-class-ref in UIView+Glow.o
 "_OBJC_CLASS_$_CAMediaTimingFunction", referenced from:
  objc-class-ref in UIView+Glow.o
  "_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
  -[UIView(Glow) startGlowing] in UIView+Glow.o
   ld: symbol(s) not found for architecture i386
   clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

xcode quartz-graphics ios

18
推荐指数
4
解决办法
4万
查看次数

为UIButton添加目标 - iOS

Anyoone可以帮助我如何使用添加动作来调用以下方法UIButton.

-(void)navigatePics:(id)sender andIndex:(NSInteger *)index{}
Run Code Online (Sandbox Code Playgroud)

uibutton ios

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

使用ADB访问屏幕上的特定UI控件

adb shell控制台是否可以使用其ID访问Android应用程序的特定按钮?还是文字?

我正在尝试自动按下设备上的按钮.这是从浏览器访问的Web应用程序.所以,如果我有那个按钮ID,我可以向该按钮发送动作吗?

android adb buttonclick

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

在UIVisualEffect视图上创建透明孔

我正在尝试在UIVisualEffectView上创建一个透明孔类型的视图.我按照这里给出的解决方案.我附上了我在这里工作的示例代码.我正在尝试创建一个透明视图,其框架取自模糊视图后面的图像视图.谁能告诉我这里我做错了什么?

objective-c ios uivisualeffectview

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

UITableView使用UIRefreshControl闪烁

我有一个UITableViewUIRefreshControl内侧限定viewDidLoad:的方法UIViewController如下:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.refreshControl = [[UIRefreshControl alloc] init];
    [self.refreshControl addTarget:self action:@selector(refreshMessages) forControlEvents:UIControlEventValueChanged];
    UITableViewController *tableViewController = [[UITableViewController alloc] init];
    tableViewController.tableView = self.messagesTableView;
    tableViewController.refreshControl = self.refreshControl;  
}

- (void)refreshMessages {
    //load data items
    if ([self.refreshControl isRefreshing]) {
        [self.refreshControl endRefreshing];
    }

    [self.messagesTableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)

我使用自定义单元格来更新单元格数据.在重新加载数据时UITableView闪烁.有办法避免这种情况吗?

编辑 我已将视频文件链接到示例演示.在UITableView重新加载数据,闪烁.我使用autolayout来更新动态单元格高度.

以下是可以重新创建此问题的示例代码.应该拉UITableView刷新.表视图在主队列上重新加载.正在使用自动布局调整单元格的大小.


objective-c uitableview uiviewcontroller ios uirefreshcontrol

10
推荐指数
3
解决办法
4277
查看次数

使用nsmutabledictionary创建嵌套的JSON字符串

我正在尝试创建以下格式的json字符串:

{
  "cat_id" : 4992, 
  "brand"  : "Toshiba",
  "weight" : { "gte":1000000, "lt":1500000 },
  "sitedetails" : {
      "name" : "newegg.com",
      "latestoffers" : {
          "currency": "USD",
          "price"   : { "gte" : 100 } 
     }
 }
}
Run Code Online (Sandbox Code Playgroud)

我用以下方法生成这个:

-(void)queryBuilderWithObj:(NSString *)object andKeyValue:(NSString *)key{
NSLog(@"object %@ and key %@",object,key);


if([key rangeOfString:@","].location == NSNotFound){
    [querybuild setObject:object forKey:key];
}else{
    NSArray *tempArray = [key componentsSeparatedByString:@","];
    int index = tempArray.count - 1;
    NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] init];
    while (index) {
        if (index == tempArray.count - 1) { …
Run Code Online (Sandbox Code Playgroud)

json key nsmutabledictionary ios

9
推荐指数
3
解决办法
8395
查看次数

变量的Python字符串编码

我知道对于Python <3,字符串'Plants vs. Zombies‰2'的unicode编码如下:

u"Plants vs. Zombies䋢 2".encode("utf-8")
Run Code Online (Sandbox Code Playgroud)

如果我有一个变量(比如appName)而不是字符串,我可以这样做:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")
Run Code Online (Sandbox Code Playgroud)

对于:

 appName = appName.encode('utf-8');


 'ascii' codec can't decode byte 0xe4 in position 18: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)

python unicode encoding

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