我创建了包含4个按钮的AlertDialog
OptionDialog = new AlertDialog.Builder(this);
OptionDialog.setTitle("Options");
LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = li.inflate(R.layout.options, null, false);
background = (Button) v.findViewById(R.id.bkgSpinnerLabel);
SoundVib = (Button) v.findViewById(R.id.SoundVibSpinnerLabel);
OptionDialog.setView(v);
OptionDialog.setCancelable(true);
OptionDialog.setNeutralButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
}
});
background.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
SetBackground();
// here I want to dismiss it after SetBackground() method
}
});
SoundVib.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent soundVibIntent = new Intent(SebhaActivity.this, EditPreferences.class);
startActivity(soundVibIntent);
}
});
OptionDialog.show();
Run Code Online (Sandbox Code Playgroud)
我想在SetBackground()方法之后解雇它,我该怎么做呢?提前致谢.
如果我有两个活动Activity1和Activity2,我想在没有Start Activity2的情况下将数据从Activity1发送到Activity2
我知道如果我想启动Activity2,我在Activity1.java中使用此代码
Intent intent ;
Bundle bundle = new Bundle();
bundle.putString(BG_SELECT, hexColor);
intent = new Intent(getApplicationContext(), Activity2.class);
intent.putExtras(bundle);
// this is to start but I want just refresh Activity2 not start it
startActivityForResult(intent, uniqueNo);
Run Code Online (Sandbox Code Playgroud)
并在Activity2.java中
bundle = getIntent().getExtras();
if (bundle != null) {
bgColor = bundle.getString(SebhaActivity.BG_SELECT);
System.out.println("in Activity2, selected BG: "+bgColor);
}
Run Code Online (Sandbox Code Playgroud)
如何刷新Activity2以在其中找到数据而不启动它?提前致谢.
我希望将一个字符串从一个活动传递到另一个活动,其中一个是我写的
public void pdfView(File f){
// f is: /data/data/com.example.iktabClasses/files/fileName.pdf
Intent intent = new Intent(getApplicationContext(),NewPdfActivity.class);
intent.putExtra("filename", f);
startActivity(intent);
}
Run Code Online (Sandbox Code Playgroud)
在我写的其他活动中:
Bundle b=getIntent().getExtras();
if (b != null) {
filename = getIntent().getStringExtra("filename");
System.out.println("filename: "+filename);
}
Run Code Online (Sandbox Code Playgroud)
但文件名始终返回为"null".怎么解决这个?提前致谢.//////////////////
我做到了
Intent intent;
Bundle b = new Bundle();
b.putString("filename", f.toString());
intent = new Intent(getApplicationContext(),NewPdfActivity.class);
intent.putExtras(b);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
现在它起作用了
如果我NSCachesDirectory
在我的应用程序中以编程方式下载文件,是否也可以通过编程方式删除文件?
我想在应用商店中添加一个新应用,他们问我一个名字和SKU号码,而不是我必须选择你的应用ID.
当我选择应用程序ID来制作新应用程序时,我找不到我需要的应用程序ID.我只能找到那些我从未使用过的东西.
有谁知道如何解决这个问题?
提前致谢.
我正在尝试通过UINavigationController将int变量传递给UITableView(我正在使用xcode 4.3)所以我创建了2个类(PartsTableViewController是"UITableViewController"和PartsNavController,它是"UINavigationController"),我想从我当前传递变量类到PartsTableViewController,然后打开该表及其包含标题栏的导航控制器,所以我在当前类中编写了以下代码:
PartsNavController *partsNav = [self.storyboard instantiateViewControllerWithIdentifier:@"partsNav"];
partsNav.groupId = myGroupp.bg_id;
[self presentModalViewController:partsNav animated:YES];
Run Code Online (Sandbox Code Playgroud)
在我在viewDidLoad中编写的PartsNavController类中:
PartsTableViewController *parts = [self.storyboard instantiateViewControllerWithIdentifier:@"Parts"];
parts.groupId = groupId;
[parts.tableView reloadData];
Run Code Online (Sandbox Code Playgroud)
在我在viewDidLoad中写的PartsTableViewController中:
NSLog(@"This is group: %d", groupId);
Run Code Online (Sandbox Code Playgroud)
但运行时,它会产生2次输出,
This is group:1
This is group:0
Run Code Online (Sandbox Code Playgroud)
第一次是我发送的值,第二次是0,我只想要我发送的值,而不是0我怎么能阻止这个,只得到我发送的值????
我想从(MaktabatyTableViewController)传递到(PartsTableViewController)而不使用segue
我想在if条件下添加系列
if (count == 33 || count == 66 || count == 99
|| count == 132 || count == 165 || count == 198
|| count == 231 || count == 264 || count == 297
|| count == 330 || count == 363 || count == 396
|| count == 429 || count == 462 || count == 495
|| count == 528 || count == 561 || count == 594
|| count == 627 || count == …
Run Code Online (Sandbox Code Playgroud) android ×3
ios ×3
bundle ×2
ipad ×2
iphone ×2
objective-c ×2
cocoa-touch ×1
dismiss ×1
if-statement ×1
java ×1