这是我的build.gradle应用级文件.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "it.myco.app.myproj"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
Android Studio突出显示该行
compile 'com.android.support:appcompat-v7:26.+'
Run Code Online (Sandbox Code Playgroud)
随着消息
避免在版本号中使用+会导致不可预测和不可重复的构建
此行由Android Studio自动生成.为何会出现此警告信息 我需要写什么来解决警告?
我使用以下方法从本地存档中选择 PDF:
startActivityForResult(Intent.createChooser(new Intent().setType("application/pdf").setAction(Intent.ACTION_GET_CONTENT), getString(R.string.str_select_file)), request_id_archive);
Run Code Online (Sandbox Code Playgroud)
并管理结果:
@Override
protected void onActivityResult(int request_code, int result_code, Intent data) {
super.onActivityResult(request_code, result_code, data);
if (request_code == request_id_archive && result_code == RESULT_OK && data != null && data.getData() != null) {
Uri myuri = data.getData();
String mypath = myuri.getPath();
File myfile = new File(mypath);
Log.d("mylog1", uri.toString());
Log.d("mylog2", uri.getPath());
Log.d("mylog3", f.getPath());
Log.d("mylog4", f.toString());
Log.d("mylog5", Boolean.toString(f.exists()));
}
else {...}
Run Code Online (Sandbox Code Playgroud)
看来该文件没有成功创建。我的日志结果是:
方法 …
在基于Symfony2的Web应用程序上,我正在开发一个页面,可以在其中插入数据库中的新记录。插入操作正常工作,无论如何,实际上在确认正确插入数据之后,但是Web应用程序以与我插入数据相同的形式返回了我。如何将页面重定向到另一条路线,例如到显示新插入数据的页面?
这是我的控制器中用于创建新记录的操作:
public function newAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$form = $this->createForm(new AnagraficaType(), new Anagrafiche() );
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
$anagrafica = $form->getData();
$em->persist($anagrafica);
$em->flush();
}
}
return $this->render('AcmeMyBundle:Anagrafica:new.html.twig', array('form' => $form->createView()));
}
Run Code Online (Sandbox Code Playgroud)
这是用于页面以创建新记录的routing.yml部分:
AcmeMyBundle_newAnag:
pattern: /anagrafica/new
defaults: { _controller: AcmeMyBundle:Anagrafica:new}
Run Code Online (Sandbox Code Playgroud)
这是该页面的routing.yml部分,它允许我详细显示DB中我的“ anagrafica”对象的单个记录:
AcmeMyBundle_showAnag:
pattern: /anagrafica/{id}
defaults: { _controller: AcmeMyBundle:Anagrafica:show }
requirements:
_method: GET
id: \d+
Run Code Online (Sandbox Code Playgroud)
这是我的控制器中管理页面的操作,用于详细显示数据库中我的“ anagrafica”对象的单个记录:
public function showAction($id)
{
$em = $this->getDoctrine()->getEntityManager();
$anagrafica = $em->getRepository('AcmeMyBundle:Anagrafiche')->find($id);
if (!$anagrafica) {
throw $this->createNotFoundException('Unable to find anagrafica …Run Code Online (Sandbox Code Playgroud)