小编use*_*987的帖子

Android Volley Null指针异常

我正在尝试将以前基于活动的教程转换为片段,但我继续在我的适配器上遇到NullPointerException错误.

本教程基于,我已经缩减了适配器的构造函数,因为它曾经调用了一个Activity.

这里有一种可能的解决方案,但没有人知道如何处理同样可能的问题.

我想将所有内容转换为工作片段.如果您需要我提供更多信息,请与我们联系.

主要转换类:

public class mainViewController2 extends Fragment {
    private static final String TAG = mainViewController2.class.getSimpleName();
    private ListView listView;
    private FeedListAdapter listAdapter;
    private List<FeedItem> feedItems;
    private String URL_FEED = "http://api.androidhive.info/feed/feed.json";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                    Bundle savedInstanceState) {

        View v = inflater.inflate(R.layout.mainviewcontroller2_fragment, container, false);

        listView = (ListView) v.findViewById(R.id.list);

        feedItems = new ArrayList<FeedItem>();


        //where the error shows up?
        listAdapter = new FeedListAdapter(feedItems);
        listView.setAdapter(listAdapter);



        // We first check for cached request
        Cache cache = …
Run Code Online (Sandbox Code Playgroud)

java android json android-fragments android-volley

10
推荐指数
3
解决办法
2万
查看次数

简单的iOS从UIAlertView收集字符串

我试图将数据发布到数据库,但问题是我似乎无法从用户获取在UIAlertView中输入的文本.我已经尝试了很多解决方案,例如子视图UITextField,但没有运气.这是我目前的简单配置.如果您需要更多信息,请与我们联系.

- (void)viewDidLoad
{
    [super viewDidLoad];

    //load site in webview
    NSURLRequest *siteRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://google.com/"]
                                                  cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
                                 [webview loadRequest:siteRequest];


    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Please enter your email address." delegate:self cancelButtonTitle:@"Submit" otherButtonTitles:@"Skip", nil];
    alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextField *emailInput = [alertView textFieldAtIndex:0];
    [alertView show];

    emails=emailInput.text;

  //  NSLog(emails);


    phone=@"8675309";

    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
Run Code Online (Sandbox Code Playgroud)

string iphone nsstring uialertview ios

2
推荐指数
1
解决办法
1099
查看次数

简单的PHP表单不提交

该页面似乎没有写入数据库.我有一种感觉,这可能是数据库错误,而不是表单提交本身.我找不到任何错误,我似乎无法弄清楚为什么数据库不接受我的参数.请参阅下面的代码和数据库结构.如果您需要更多信息,请与我们联系.

    <?php
session_name('shipshapeLogin');
session_set_cookie_params(2*7*24*60*60);
session_start();

define('INCLUDE_CHECK',true);

require('connect.php');
//require_once('business.php');

if(empty($_SESSION['id']))
{
    header("Location: index.php");
    exit;
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Ad Posting</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script src="https://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <link rel="stylesheet" type="text/css" href="advertise.css" />
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script>
  $(function() {
    $( "#from" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 3,
      onClose: function( selectedDate ) {
        $( "#to" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#to" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 3,
      onClose: function( selectedDate ) { …
Run Code Online (Sandbox Code Playgroud)

php mysql mysqli pdo innodb

0
推荐指数
1
解决办法
91
查看次数