我得到错误:java.lang.NullPointerException:当我调用此方法时,println需要一条消息:
lst_info = new HashMap<String, String>();
SystemDatabaseHandler db = new SystemDatabaseHandler(getApplicationContext());
lst_info = db.getLstInfo(sql_id);
Run Code Online (Sandbox Code Playgroud)
SystemDatabaseHandler:
public HashMap<String , String> getLstInfo(int id){
HashMap<String , String> lst_temp;
lst_temp = new HashMap<String , String>();
String selectQuery = "SELECT * FROM dkr_lst_lst WHERE lst_id = " + id;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Log.d("sql_id", cursor.getString(0));
lst_temp.put("sql_id", cursor.getString(0));
}while (cursor.moveToNext());
}
cursor.close();
db.close();
return lst_temp;
}
Run Code Online (Sandbox Code Playgroud)
Log.d("sql_id",cursor.getString(0)); 收益:
07-12 11:56:05.603:D/sql_id(13783):1
Log Cat:
07-12 11:56:05.613: D/Database(13783): dbclose(): …Run Code Online (Sandbox Code Playgroud) 我发现这两种可能性来显示pdf文件.
使用以下命令打开webView:
webView.loadUrl("https://docs.google.com/gview?embedded=true&url="+uri);
使用extern App打开pdf文件:
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(不过outFile), "应用/ PDF"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(意向);
他们都工作.但我的问题是pdf仅供内部使用,在两个示例中,用户可以下载或将其保存在另一个文件夹中.
我知道iOS开发中的框架,我正在寻找适用于Android的解决方案.
我刚开始使用Xcode和Swift.
我尝试构建我的第一个iOS应用程序.但是现在我遇到了问题,我不知道如何实现后退按钮,所以我之前回到了视图中.
我的故事板看起来像这样:
当我打开AZ视图时,我想显示后退箭头,这会让我回到第2项视图.
要打开A - Z视图,我将按钮"Medikamente A - Z"与导航控制器连接.
我尝试解析我的DatabaseHandler类中的文件,但Eclipse说:
对于DatabaseHandler类型,未定义getAssets()方法
这是代码:
public class DatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 15;
public DatabaseHandler(Context context) {
super(context, "rettinfo", null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
Log.d("Create: ", "Creating antidotlist");
String CREATE_ANTIDOT_TABLE = "CREATE TABLE antidots (id INTEGER PRIMARY KEY antidot TEXT, dos TEXT)";
Log.d("Create: ", CREATE_ANTIDOT_TABLE);
db.execSQL(CREATE_ANTIDOT_TABLE);
InputStream antidots = getAssets().open("antidot/antidots");
InputStreamReader input = new InputStreamReader(antidots);
BufferedReader buffreader = new BufferedReader(input,2*1024);
String line;
while ((line = buffreader.readLine()) != null) {
String[] point_t = line.split(","); …Run Code Online (Sandbox Code Playgroud) 我用php构建了自己的模板系统.一个简短的例子只是为了解释我的问题:
<!DOCTYPE HTML>
<html lang="de">
<head>
<link rel="stylesheet" type="text/css" href="../css/main.css" />
</head>
<body>
<?php include('body.html'); ?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
现在,当我用Netbeans打开body.html文件时
<div class="content">
Hello
</div>
Run Code Online (Sandbox Code Playgroud)
Netbeans说:没有找到类内容
是否可以将css文件分配给html文件,以便Netbeans找到该类?
当我点击RelativeLayout时,它会改变大小.如何将此更改设为动画?所以看起来矩形会变成全屏?
我的布局:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:background="#ff000000">
<RelativeLayout
android:id="@+id/srLayout"
android:layout_width="62.5dp"
android:layout_height="132.5dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="false"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:clickable="true"
android:onClick="sleepRoom"
android:background="#ffffffff"></RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
代码:
public void sleepRoom(View view) {
RelativeLayout sr = (RelativeLayout) findViewById(view.getId());
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) sr.getLayoutParams();
params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
params.width = RelativeLayout.LayoutParams.MATCH_PARENT;
sr.setLayoutParams(params);
}
Run Code Online (Sandbox Code Playgroud) 当我想从列表中的组件打开详细视图时,出现此错误。我正在使用 Ionic 4。
错误错误:未捕获(承诺):错误:无法匹配任何路由。URL 段:'algodetail'
我找到了很多有这个错误的主题,但没有找到解决方案。我不确定,也许只是拼写错误?
列表视图:
<ion-content padding>
<ion-card *ngFor="let algo of algoList | async" routerLink="/algodetail/{{algo.id}}">
<ion-card-header>
{{ algo.title }}
</ion-card-header>
</ion-card>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
app-routing.module.ts 中的路由:
const routes: Routes = [
{ path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
{ path: 'algodetail/:id', loadChildren: './algodetail/algodetail.module#AlgodetailPageModule' }
];
Run Code Online (Sandbox Code Playgroud)
algodetail.page.ts:
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { Algo } from '../models/algo';
import { FirestoreService } from '../services/data/firestore.service';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-algodetail',
templateUrl: …Run Code Online (Sandbox Code Playgroud) 我在Listview中显示我的SQLite数据库中的项目.对于添加项目,我使用AlertDialog.在ALertDialog中,我将项目保存在我的数据库中,并使用数据库中的数据刷新List(userLists).然后我使用notifyDataSetChanged但视图不会改变.
public class MediUserListsFragment extends Fragment {
private MediDAO mediDAO;
private ListView listView;
private List<UserList> userLists;
private ArrayAdapter<UserList> adapter;
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
getActivity().setTitle("Medikamenten Listen");
final View view = inflater.inflate(R.layout.fragment_medi_user_list, container, false);
setHasOptionsMenu(true);
mediDAO = new MediDAO(getContext());
userLists = mediDAO.getAllUserList();
listView = (ListView) view.findViewById(R.id.list_view);
adapter = new ArrayAdapter<>(getContext(),android.R.layout.simple_list_item_1, userLists);
listView.setAdapter(adapter);
Button newLstBtn = (Button) view.findViewById(R.id.new_list_button);
newLstBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
View alertLayout = inflater.inflate(R.layout.dialog_medi_list_new, null);
final EditText newLstName = …Run Code Online (Sandbox Code Playgroud) 我的实体Item有一个ItemRepository具有该功能的存储库() findItemCount()。当我使用
$repository = $em->getRepository(Item::class); \n$items = $repository->findItemCount();\nRun Code Online (Sandbox Code Playgroud)\n我收到警告:
\n\n\n潜在的多态调用。根据作为参数传递的实际类实例,代码可能无法运行。
\n
此外,自动完成功能也不建议我使用“findItemCount”功能。我的错误是什么?
\n控制器:
\n/**\n * Artikel Liste\n * @Route("/item/list", name="app_item_list")\n * @param EntityManagerInterface $em\n * @return Response\n */\npublic function listItems(EntityManagerInterface $em): Response\n{\n $repository = $em->getRepository(Item::class);\n $items = $repository->findItemCount();\n\n return $this->render('item_admin/itemList.html.twig', [\n 'items' => $items,\n 'title' => 'Artikel \xc3\x9cbersicht',\n 'blocked' => false\n ]);\n}\nRun Code Online (Sandbox Code Playgroud)\n项目.php
\n<?php\n\nnamespace App\\Entity;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Doctrine\\ORM\\Mapping\\OrderBy;\n\n/**\n * @ORM\\Entity(repositoryClass="App\\Repository\\ItemRepository")\n */\nclass Item\n{\n /**\n …Run Code Online (Sandbox Code Playgroud) 我希望 StackPanel 中的所有按钮都具有相同的样式。
是否有类似 HTML / CSS 的可能性?
例如,这使得 HTML 中 myBox 类的所有按钮的文本均为蓝色:
CSS
.myBox Button{
color: blue;
}
Run Code Online (Sandbox Code Playgroud)
超文本标记语言
<div class="myBox">
<button type="button">1</button>
<button type="button">2</button>
<button type="button">3</button>
</div>
Run Code Online (Sandbox Code Playgroud)
当我现在有了这个 StackPanel 时,如何将所有 Button 文本设为蓝色?
<StackPanel Orientation="Vertical" x:Name="ManagerMenu">
<Button x:Name="1" Content="1" />
<Button x:Name="2" Content="2" />
<Button x:Name="3" Content="3" />
</StackPanel>
Run Code Online (Sandbox Code Playgroud) 我为Android编写了一个应用程序,以便可以从SAT接收器流式传输文件。像mkv(从我的PC上复制)之类的文件可以正常工作(带有DTS的文件除外->我希望这将在以后的更新中提供)。
但是,当我想流式传输ts文件(来自Sat-Receiver的录制文件)时,我的Chromecast加载并加载或崩溃。从我的Chromecast调试器控制台返回我:无法加载元数据。
因为mkv文件可以在同一位置正常工作,所以我认为TS文件存在问题。
您可以在此处找到示例TS文件:https : //drive.google.com/file/d/0B7pcAkvWOZoNZ0RsSVVUUFNrZlk/view
也许有人可以向我解释文件为什么会出问题。
编辑
这是谷歌的答案:
目前不支持直接在HTML视频元素中播放ts文件。但是,支持属于HLS流的ts文件。有关支持的媒体的更多详细信息,请参阅以下链接:https : //developers.google.com/cast/docs/media
但是我如何制作HLS流?
我在我的应用程序中有一个包含许多开关的设置活动.我试图避免编写50个setOnCheckedChangeListener我试图在布局文件中设置onClick事件:
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/switchVibra"
android:layout_weight="0.1"
android:onClick="switchChange" />
Run Code Online (Sandbox Code Playgroud)
方法:
public void switchChange(View v){
switch (v.getId()){
case R.id.switchVibra:
// Do something
break;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当您擦除开关时,此方法不会注册更改.还有其他选项可以避免为每个开关编写一个监听器吗?
我有这门课:
class IndiClass: Object {
dynamic var MediIndiGrpId = 0
dynamic var MediIndiGrpName = ""
let Medis = List<MediClass>()
override static func primaryKey() -> String? {
return "MediIndiGrpId"
}
}
Run Code Online (Sandbox Code Playgroud)
我想现在添加一个MediClass对象到列表中.此代码显示了我如何获取对象以及如何尝试添加MediClass对象:
//Get a MediClass Object
let medi = realm.objectForPrimaryKey(MediClass.self, key: 1)
// Get the IndiClass Object
let indi = realm.objectForPrimaryKey(IndiClass.self, key: 1)
// Try to add the MediClass Object to the IndiClass Object:
indi!.Medis.append(medi!)
Run Code Online (Sandbox Code Playgroud)
最后一行停止了应用程序,在控制台中它显示了我:
由于未捕获的异常"RLMException"而终止应用程序,原因是:"无法在写入事务之外改变持久化数组."