我试图让用户长时间点击地图,而不是创建标记,新活动应该打开.它应包含纬度和经度,即用户点击的位置.
我知道使用对话框时数据传输很容易,但我不想在我的应用程序的这一部分使用对话框片段.
MapActivity:
//Add marker on long click
final double finalLongitude = longitude;
final double finalLatitude = latitude;
mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
// start SendMessageActivity need to add marker to message activity
Intent intent = new Intent(getActivity(), DisplayLocationActivity.class);
intent.putExtra("latitude",""+ finalLatitude);
intent.putExtra("longitude", "" + finalLongitude);
startActivity(intent);
}
Run Code Online (Sandbox Code Playgroud)
DisplayLocationActivity:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_location);
Bundle bundle = getIntent().getExtras();
double lat = bundle.getDouble("latitude");
double lng = bundle.getDouble("longitude");
//display lat lng
mLatDisplay = (TextView) findViewById(R.id.latTextViewDisplay);
mLangDisplay = (TextView) findViewById(R.id.lngTextViewDisplay);
mLatDisplay.setText(String.valueOf(lat));
mLangDisplay.setText(String.valueOf(lng));
} …Run Code Online (Sandbox Code Playgroud) 我开始通过修改示例来学习软件开发.现在我正在制作一个联系人列表,我想从本地SQLite数据库中填充它,通过修改本教程而不是从json获取数据我想从我的本地数据库获取数据.我有一个包含许多联系人的本地数据库.
这是我的问题:当我打开我的联系人列表时,进度对话框一直在旋转,并且没有显示任何联系人.
这是我的代码:
SQLiteHandler:
public List<Contact> getMyContactDetails() {
List<Contact> contacts = new ArrayList<Contact>();
String selectQuery = "SELECT * FROM " + TABLE_CONTACTS;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor != null) {
try {
while (cursor.moveToNext()) {
Contact contact = new Contact();
contact.setUserName(cursor.getString( cursor.getColumnIndex(DISPLAY_NAME)));
contact.setThumbnailUrl(cursor.getString( cursor.getColumnIndex(IMAGE)));
contacts.add(contact);
}
} finally {
cursor.close();
}
}
db.close();
return contacts;
}
Run Code Online (Sandbox Code Playgroud)
ContactListAdapter:
public class ContactsListAdapter extends BaseAdapter {
private Activity activity;
private LayoutInflater inflater;
private …Run Code Online (Sandbox Code Playgroud) 下面是我的代码,我需要将默认值传递给单选按钮
<div class="ui-g-12">
<p-radioButton name="group1" value="Option 1" label="Option 1" [(ngModel)]="val1" inputId="opt1"></p-radioButton>
</div>
<div class="ui-g-12">
<p-radioButton name="group1" value="Option 2" label="Option 2" [(ngModel)]="val1" inputId="opt2"></p-radioButton>
</div>
<div class="ui-g-12">
<p-radioButton name="group1" value="Option 3" label="Option 3" [(ngModel)]="val1" inputId="opt3"></p-radioButton>
</div>
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释如何在表单加载时将默认值设置为单选按钮
选择任何列表视图时如何使用叠加活动指示器.
<ListView x:Name="lstView" ItemsSource="{Binding Items}"
ItemTapped="Handle_ItemTapped"
ItemSelected="Handle_ItemSelected">
<ListView.Header>
<Label Text="Store Allocation" BackgroundColor="White" TextColor="Black" FontAttributes="Bold" HorizontalOptions="Fill" HorizontalTextAlignment="Center" />
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Title}" Height="200" Detail="{Binding Detail}" DetailColor="Black" TextColor="Red" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud) 在 ASP.NET Core 中,ViewComponent我们必须在InvokeAsync返回IViewComponentResult. async但是,我在调用方法内没有执行任何逻辑。因此,根据此处的帖子,我删除了async限定符并返回Task.FromResult
public Task<IViewComponentResult> InvokeAsync(MyBaseModel model)
{
var name = MyFactory.GetViewComponent(model.DocumentTypeID);
return Task.FromResult<IViewComponentResult>(View(name, model));
}
Run Code Online (Sandbox Code Playgroud)
然后在视图中(因为我没有,所以async我不在await这里使用)
@Component.InvokeAsync("MyViewComponent", new { model = Model })
Run Code Online (Sandbox Code Playgroud)
然而视图呈现这个:
System.Threading.Tasks.Task1[Microsoft.AspNetCore.Html.IHtmlContent]`
android ×2
angular ×1
asp.net-core ×1
async-await ×1
c# ×1
google-maps ×1
java ×1
listview ×1
primeng ×1
sqlite ×1