当我的Android应用程序使用intent尝试发布时,Instagram崩溃了

时间:2015-09-03 05:37:52

标签: android android-intent instagram appcelerator

我正在开发一款适用于Android的应用程序,它应该与Instagram应用程序共享图像。该应用程序打开相机,拍照,然后打开Instagram应用程序与"裁剪照片"窗口活跃。它似乎正在加载图片,但几秒钟后应用程序崩溃,我无法看到图像被加载。

不要明白我哪里出错了。

谢谢.. !!!

 var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_SEND,
    packageName:"com.instagram.android",
    type: "image/*"
});

intent.putExtraUri(intent.EXTRA_STREAM,MediaPath);
intent.putExtra(Ti.Android.EXTRA_TEXT, "Posting via My Andorid App... Testing");
intent.FLAG_ACTIVITY_CLEAR_TOP;
Ti.Android.currentActivity.startActivity(intent);

1 个答案:

答案 0 :(得分:1)

我认为您应该使用我已经在我的代码中实现的代码:

Class:  WalkOverATree
Method: maxNodesVisited
Parameters: int[], int
Returns:    int
Method signature:   int maxNodesVisited(int[] parent, int L)
(be sure your method is public)

Examples 
0)  
         {0, 0} 2 Returns: 2 The tree consists of edges 1-0 and 2-0. Our person will start in node 0 and can make at most L=2 steps. In two
 steps, the best we can do is visit one of the nodes 1 and 2. 

1)  
         {0, 0} 3 Returns: 3 This is the same tree, only now we have L=3. In three steps the person can visit all three nodes: for example, by
 going from node 0 to node 1, back to node 0, and finally to node 2.
 Note that even though the person visited node 0 twice, we only count
 it once. 

2)  
         {0, 1, 2, 3} 2 Returns: 3

并调用方法打开Instagram。

String type = "image/*";
String filename = "/myPhoto.jpg";
String mediaPath = Environment.getExternalStorageDirectory() + filename;

和方法体如:

createInstagramIntent(type, mediaPath);

亲爱的更多信息,您可以看到Instagram官方网站分享图片和视频here。 享受你的代码:)