我正在构建一个OpenGL动态壁纸.我决定在我的主要活动中安装导航抽屉,因为用户可以访问许多功能.
问题/问题 如果我按"硬件"后退按钮正常关闭应用程序,显示的初始片段只会刷新,应用程序永远不会关闭.如果我点击主页按钮并返回应用程序,一切都是黑屏.我在谷歌的所有搜索中都在想,也许我没有正确地破坏MainActivity或者终止片段.我试过在main活动的onDestroy方法中调用finish().我已尝试在每个帖子中使用片段管理器中的remove方法在每个帖子中使用我在网上找到的帖子.没有任何效果.我很难过.我在onDestroy方法的主活动和onDetach方法的片段上设置了调试点,没有产生错误或给出任何信息.在这一点上,我无能为力.这是我的MainActivity类.
public class MainActivity extends AppCompatActivity implements OnNavigationItemSelectedListener, OnPostSelectedListener{
FragmentManager mFragmentManager;
FragmentTransaction mFragmentTransaction;
TextView usrTag, tagrEmail;
CircleImageView tagrPic;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
mFragmentManager = getSupportFragmentManager();
mFragmentTransaction = mFragmentManager.beginTransaction();
mFragmentTransaction.add(R.id.cLMain, new PreviewFragment()).addToBackStack("PreviewFragment").commit();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View header = navigationView.getHeaderView(0);
usrTag = (TextView)header.findViewById(R.id.usrName);
tagrEmail = (TextView)header.findViewById(R.id.usrEmail);
tagrPic = (CircleImageView)header.findViewById(R.id.usrImg);
Log.i("MainActivity: …Run Code Online (Sandbox Code Playgroud) 我最初有测试帐户在Android中测试-app购买,但我删除了测试帐户,并将应用程序从测试版转移到生产.根据文档,两个测试帐户都试图通过Google Play应用取消测试订阅.虽然谷歌播放应用程序说订阅已取消,但它仍然保持活跃状态.即使尝试卸载该应用程序.如何删除测试订阅?
我已从Play商店中删除了beta测试apk并禁用了测试.我已从许可页面以及授权的Beta测试人员列表中删除了所有测试帐户.Beta测试用户仍在报告具有有效(每日)测试订阅.无论他们取消多少次,它仍然会在第二天更新.我需要删除它.它阻碍了我们的发展进程.
android in-app-billing google-play in-app-subscription developer-console
我使用OpenGL库Rajawali3D来显示我的模型.我想知道的是如何根据登录用户从我的服务器加载纹理?我已经在互联网上搜索了几个月,但没有成功.我发现这个网站解释了如何从非本地源加载纹理,但是当我尝试它时,它不适用于Rajawali.任何建议或例子将不胜感激.
这是我试图使用的网站:来自网络的纹理
我是新手使用Simperium,但我希望它可以完成我需要的东西.鉴于该网站主要有IOS的教程和样本,我认为最好在这里寻求帮助.
我希望能够在我的网站上编辑和更新事件列表,这只是一个包含事件名称和日期的简单html列表.Simperium是否可以实现这一点?如果是这样,我将如何做到这一点?如果那里有针对Android的教程,我不必在这里问这个,但没有.
我有一个简单的贴纸小部件,允许用户在放置小部件时选择其中一个贴纸.我的问题是,一旦设备重新启动,贴纸将恢复为默认设置.无论设备是否重新启动,如何确保用户选择的标签仍然存在?一个例子或推动正确的方向将是非常有帮助的.我不是在寻找任何人为我做这件事,只是为了接受如何去做这件事的教育.谢谢.
编辑 包含的代码
我不确定,但我认为我错了.我不知道如何以我现在拥有的方式合并SharedPreferences.有人能给我一个例子说明我应该如何使用至少一张我正在使用的图片吗?
public class SpraycanConfig extends Activity
{
int xawID;
AppWidgetManager xawm;
Context xc;
EditText xinfo;
//EasyTracker easyTracker;
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
Crashlytics.start(this);
setContentView(R.layout.scconfiglayout);
this.xc = this;
Bundle localBundle = getIntent().getExtras();
if (localBundle != null) {
this.xawID = localBundle.getInt("appWidgetId", 0);
}
for (;;)
{
this.xawm = AppWidgetManager.getInstance(this.xc);
ImageButton localImageButton1 = (ImageButton)findViewById(R.id.normal);
View.OnClickListener local1 = new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
RemoteViews localRemoteViews = new RemoteViews(xc.getPackageName(), R.layout.main);
localRemoteViews.setImageViewResource(R.id.imageview, R.drawable.normal);
xawm.updateAppWidget(xawID, localRemoteViews);
Intent localIntent = new …Run Code Online (Sandbox Code Playgroud) 我曾经问过如何检索视频文件的嵌入式网址并成功完成的问题.现在我有一个不同的问题.WUnderground API网络摄像头响应的json响应提供以下URL:
https://www.wunderground.com/webcams/cadot1/902/show.html
使用JSoup并根据我的初始问题的答案,我能够得到这个嵌入式链接:
https://www.wunderground.com/webcams/cadot1/902/video.html?month=11&year=2016&filename=current.mp4
在尝试将视频从该网址"流式传输"到VideoView时,我不断收到错误"无法播放视频".在查看该链接的源代码后,我注意到需要播放的视频文件未在html中引用,而是在javascript中引用.如何获取需要播放的视频文件的直接链接?使用JSoup还是其他进程?
网址源https://www.wunderground.com/webcams/cadot1/902/video.html?month=11&year=2016&filename=current.mp4显示<script>括号内所需视频文件的以下内容:
网址:"//icons.wunderground.com/webcamcurrent/c/a/cadot1/902/current.mp4?e=1480377508"
我正在使用JSoup从响应URL获取视频的嵌入式URL,如下所示:
private class VideoLink extends AsyncTask<Void, Void, Void> {
String title;
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog.setTitle("JSOUP Test");
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
// for avoiding javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name
System.setProperty("jsse.enableSNIExtension", "false");
// WARNING: do it only if security isn't important, otherwise you have
// to follow this advices: http://stackoverflow.com/a/7745706/1363265
// Create a trust manager that does not validate certificate …Run Code Online (Sandbox Code Playgroud) 我想创建一个带有监听器的视图,它有点像容器或杂货袋.拖入其中的任何图像或文本都会被收集并保存到本地数据库中.或者更确切地说,图像名称或字符串被保存.我之前创建了自定义视图,显示了一个自定义的数据行,但我不知道如何创建一个"杂货袋"类型的视图.我搜索过谷歌创建一个带有监听器的自定义容器视图但找不到与我要查找的内容有关的任何内容.我不是要求任何人为我做这件事,只是给我一些建议或推进正确的方向.
编辑 只是为了澄清一点.我已经知道如何拖放视图了.问题在于你可以放在任何地方.我想要的是一个视图,当某个东西在其边界内被删除时,它会获得视图的字符串或标记.无论可能是什么样的观点.不知何故,这个自定义视图必须知道在其边界内删除了哪种视图,并在drop上删除该视图.
我正在按照本教程使用"T",但是当我运行应用程序时,我在logcat中收到以下消息.我不确定出了什么问题,因为班级应该在那里吗?
找不到方法android.view.ViewAnimationUtils.createCircularReveal,从方法io.codetail.animation.ViewAnimationUtils.createCircularReveal引用
主要活动:
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.Filter;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.curtrostudios.testapp.network.AppConfig;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import io.codetail.animation.SupportAnimator;
import io.codetail.animation.ViewAnimationUtils;
/**
* Created by CurTro Studios on 2/22/2016.
*/
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private …Run Code Online (Sandbox Code Playgroud) 在travisci上运行我的构建时,由于使用gradlew文件拒绝权限,它似乎失败了.我怎样才能解决这个问题?以下是Travis-ci.org上的内容:
$ java -Xmx32m -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
$ javac -J-Xmx32m -version
javac 1.7.0_76
0.00s$ ./gradlew build connectedCheck
/home/travis/build.sh: line 45: ./gradlew: Permission denied
The command "./gradlew build connectedCheck" exited with 126.
Done. Your build exited with 1.
Run Code Online (Sandbox Code Playgroud) 我一直在互联网上搜索数小时。我已经看到了很多有关如何将项目从ArrayList添加到另一个ArrayList的示例/答案,但是似乎找不到任何解释如何将项目从ArrayList添加到ArrayList的内容。
我有一个向导,将选择保存到两个不同的ArrayList。第一个屏幕将所选项目保存到ArrayList,另一个屏幕将所选项目保存到ArrayList,然后最后一个屏幕显示从ArrayList中选择的总项目。
我已经尝试过了,stringArrayList.add(modelArrayList)但是这给出了String不能应用于模型的错误。
编辑:添加的类
为了弄清楚我正在使用的东西并使之更清楚。我正在使用WizarDroid库实现“向导”,并且我尝试合并两个不同ArrayList的页面基于此处的多选教程。
型号类别:
public class NSBaseModel {
private String baseName;
public NSBaseModel(String name)
{
baseName = name;
}
public String getBaseName() {
return baseName;
}
}
Run Code Online (Sandbox Code Playgroud)
向导页面:
public class FormStepBase extends WizardStep {
ArrayList<NSBaseModel> baseNames;
ArrayList<NSBaseModel> selectedItems = new ArrayList<NSBaseModel>();
NSBaseAdapter myAdapter;
ListView myListView;
//You must have an empty constructor for every step
public FormStepBase() {
}
//Set your layout here
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { …Run Code Online (Sandbox Code Playgroud) 我知道如何使用Volley GET方法进行登录,但如果需要指定特定的"id"怎么办?我使用intent.putExtra将列表项的"id"从远程数据库传递到另一个活动.在下一个活动中,我将如何利用Volleys的GET方法使用通过"id"传递的另一个表来解析和显示数据?
在浏览器中,我可以使用以下内容来获取具有指定url和参数的响应:
http://localhost/demoapp/fetch.php?pid=2
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将该URL传递给Volley请求并在列表视图中显示响应.像这样的东西:
"http://localhost/demoapp/fetch.php?pid=" + pid
Run Code Online (Sandbox Code Playgroud)
其中"pid"将是相应id的传递字符串.
编辑:PHP代码
<?php
include_once("config.php");
$query=mysqli_query($con,"SELECT * FROM comments WHERE pid=".$_GET['pid']);
$array;
while($result=mysqli_fetch_assoc($query)){
$array[]=$result;
}
echo json_encode($array);
?>
Run Code Online (Sandbox Code Playgroud)
编辑2:JAVA代码 主要活动
JsonArrayRequest request = new JsonArrayRequest(url+url_file,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG, response.toString()); try {
for(int i=0;i<response.length();i++){
String pid=response.getJSONObject(i).getString("pid");
String name=response.getJSONObject(i).getString("product_name");
String img;
String thumb = response.getJSONObject(i).getString("product_thumb");
String detail = response.getJSONObject(i).getString("product_detail");
String rating = response.getJSONObject(i).getString("product_rating");
img = response.getJSONObject(i).getString("product_pic");
rowdata.add(new ProductRowData(pid,name,img,thumb,detail,rating));
}
} catch (JSONException e) {
// TODO Auto-generated catch …Run Code Online (Sandbox Code Playgroud) 我查看了其他 Stack Overflow 问题,但没有一个解决了该问题。以下类定义变量,然后在 HTML 代码中调用该变量。
我对另一个 PHP 页面使用了相同的方法,它运行良好。出于某种原因,它在此页面上不起作用。我已经多次这样做了,没有任何问题。PhpStorm说变量$user “可能尚未定义”,但我知道它是。我怎样才能解决这个问题?
我试过在页面顶部设置变量 global 没有运气。我尝试在 if(isset()) 之后设置变量 global 并且仍然不起作用。这是我的 PHP 代码:
<?php
session_start();
require_once 'includes/class.user.php';
$user_edit = new USER();
if(!$user_edit->is_logged_in())
{
$user_edit->redirect('index.php');
}
if(isset($_GET['user_id'])) {
$tid = $_GET['user_id'];
$stmt = $user_edit->runQuery("SELECT * FROM users WHERE user_id = :id");
$stmt->execute(array(':id' => $tid));
$user = $stmt->fetch(PDO::FETCH_ASSOC);
}
?>
<?php include('header.php'); ?>
<div class="container side-collapse-container">
<p><?php if (!empty($user['username'])) {
echo $user['username'];
} ?></p>
</div>
<?php include('footer.php'); ?>
Run Code Online (Sandbox Code Playgroud)
这是使用 XAMPP 运行后在浏览器中显示的内容
注意:未定义变量:user in …